1
votes

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?

1
Out of curiosity is there a reason you're making CloudFormation in Terraform? :)Chris Williams
Sorry I'll fix that up, I just want to create a stack. In the aws console it's under cloud formation -> stack. I just want to create a stack , or know if that's the right thinking for terraformmcbain83

1 Answers

3
votes

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.