-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: continuing to add to naming and style guide
- Loading branch information
1 parent
32123ff
commit f93957e
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,30 @@ | ||
# Naming conventions for Terraform | ||
|
||
## Resource naming | ||
- Always use underscores in resource names, consistent with the resource type. | ||
- Always use dashes in arguments, values, and places where values will be exposed to a human or read in the AWS console. This is also important because some AWS resources have restrictions on allowed characters in description values, and the error messages that these cause can be opaque. | ||
- Use descriptive singular nouns for resource names. | ||
- Do not repeat the resource type in the resource name | ||
- Within reason, do not use environment names in resource names either. Exceptions might include if you are working in one terraform directory that provisions the entirety of the AWS account and you have no choice :) | ||
```hcl | ||
# | ||
# Good example | ||
# | ||
resource "aws_instance" "jenkins" { | ||
tags = { | ||
... | ||
"environment" = "staging" | ||
... | ||
} | ||
} | ||
# | ||
# Bad example | ||
# | ||
resource "aws_instance" "jenkins_ec2_instance_staging" { | ||
... | ||
} | ||
``` | ||
Please refer to the following sheet for various naming conventions, including of terraform modules. | ||
|
||
[Infrasec Naming Conventions](../aws/naming.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters