Zacharius
Zacharius

Reputation: 33

How can I create nested resources in Terraform?

I would like to first create a Digital Ocean droplet(server) and then create multiple docker containers for various services inside that server.

I feel like this should be easy but I cannot find any examples of others doing this. Any help would be greatly appreciated.

Upvotes: 2

Views: 3259

Answers (1)

Jamie
Jamie

Reputation: 3372

You cannot really nest resources like that in Terraform. You have a two different ways to approach this, I would use the user_data argument that will run a script on your droplet that will issue the docker commands to pull down your container images and start your containers. Here is a blog post with an example.

Hope this helps.

Upvotes: 1

Related Questions