Terraform Tip - Make Your Resource Names Unique
A good habit to get into when using Terraform is to make your resource names unique by default.
For example, if you have an AWS account that contains workloads for multiple environments, you might add the environment name to your resources.
module "ec2" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "5.0.0"
name = "instance-${var.env}"
...
}
This is especially true for globally namespaced resources that are a pain to recreate, such as s3 buckets.
Using unique names makes it easier to spin up more infrastructure within the same account in the future.
Master GitHub Actions with a Senior Infrastructure Engineer
As a senior staff infrastructure engineer, I share exclusive, behind-the-scenes insights that you won't find anywhere else. Get the strategies and techniques I've used to save companies $500k in CI costs and transform teams with GitOps best practices—delivered straight to your inbox.
Not sure yet? Check out the archive.
Unsubscribe at any time.