Skip to content

Commit cf38625

Browse files
authored
Bridgecrew compliance (#125)
1 parent dc69999 commit cf38625

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# .tfstate files
55
*.tfstate
66
*.tfstate.*
7+
**/.terraform.lock.hcl
78

89
# .tfvars files
910
*.tfvars

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ you can exclude environment and the label `id` will look like `{namespace}-{stag
3737
- If you want the attributes in a different order, you can specify that, too, with the `label_order` list.
3838
- You can set a maximum length for the name, and the module will create a unique name that fits within that length.
3939
- You can control the letter case of the generated labels which make up the `id` using `var.label_value_case`.
40-
- The labels are also exported as tags. You can control the case of the tag names (keys) using `var.label_tag_case`.
40+
- The labels are also exported as tags. You can control the case of the tag names (keys) using `var.label_key_case`.
4141

4242
It's recommended to use one `terraform-null-label` module for every unique resource of a given resource type.
4343
For example, if you have 10 instances, there should be 10 different labels.

README.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ description: |-
3434
- If you want the attributes in a different order, you can specify that, too, with the `label_order` list.
3535
- You can set a maximum length for the name, and the module will create a unique name that fits within that length.
3636
- You can control the letter case of the generated labels which make up the `id` using `var.label_value_case`.
37-
- The labels are also exported as tags. You can control the case of the tag names (keys) using `var.label_tag_case`.
37+
- The labels are also exported as tags. You can control the case of the tag names (keys) using `var.label_key_case`.
3838
3939
It's recommended to use one `terraform-null-label` module for every unique resource of a given resource type.
4040
For example, if you have 10 instances, there should be 10 different labels.

examples/autoscalinggroup/main.tf

+12-2
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,21 @@ resource "aws_launch_template" "default" {
2323
enabled = false
2424
}
2525

26-
# terraform-null-label example used here: Set tags on volumes
26+
# terraform-null-label example used here: Set tags on everything that can be tagged
2727
tag_specifications {
28-
resource_type = "volume"
28+
for_each = ["instance", "volume", "elastic-gpu", "spot-instance-request"]
29+
30+
resource_type = each.value
2931
tags = module.label.tags
3032
}
33+
34+
# Bridgecrew BC_AWS_GENERAL_26
35+
tags = module.label.tags
36+
37+
# Bridgecrew compliance: Ensure Instance Metadata Service Version 1 is not enabled (BC_AWS_GENERAL_31)
38+
metadata_options {
39+
http_tokens = "required"
40+
}
3141
}
3242

3343
######################

0 commit comments

Comments
 (0)