Terraform modules are the most useful way to group AWS resources together. It’s easy to provision an S3 bucket, SNS topic, SQS queue, IAM policy, and IAM role all wired together. Some AWS resources are scoped at the AWS account, region, VPC, or even resource level.
What are some good patterns for naming these resources so they can be instantiated across multiple AWS accounts and resources?
For example, if a module is instantiated within an AWS account, and the module creates an IAM role, how is this module invoked across multiple regions?
Sometimes we use the name_prefix
attribute to let Terraform automatically generate some unique names for us. We have also considered using the pet-names
provider, or coming up with a globally unique naming convention:
ENV-REGION-RESOURCE_NAME
What are your patterns?