mcbain83
mcbain83

Reputation: 512

How to create a Stack in AWS via Terraform?

My goal is to be able to create a 'stack' in AWS, i.e a grouping of related resources I can update and change using Terraform.

I've been attempting to read the documentation but I'm a little confused as to how I could accomplish this in terraform.

I understand the concept of possibly writing modules which are reusable, but I'm used to dealing with CF stacks when using AWS. Is there an idiomatic way to do this in terraform? It seems that maybe the concept of a stack is abstracted away somewhat. i.e if I want to get and output from a resource.. eg a RDS url, I can reference that in the Terraform code and it will evaluate and determine it at runtime rather than reading a CF stack output value in AWS?

Is this correct?

Upvotes: 1

Views: 2528

Answers (1)

Chris Williams
Chris Williams

Reputation: 35238

From what I understand you are wanting to understand how to write a replica of a "stack" in Terraform and want to understand the concepts.

There are great number of resources for seeing example stacks, take a look at the official Terraform AWS examples to get a feel for notation.

You're describing modules etc which are best practice, however start small. Add to your main.tf file a simple infrastructure and then build on that.

The best way to learn will be through doing, but take it at a steady pace.

And yes you can reference your resources, generally before you run terraform apply everything is evaluated. Any resource dependencies will be created in order.

Upvotes: 3

Related Questions