Skip to content

Commit 5fffe73

Browse files
authored
Merge pull request Coalfire-CF#20 from Coalfire-CF/remove_volume_tags
Remove_volume_tags
2 parents 98f8b1c + af44489 commit 5fffe73

File tree

4 files changed

+28
-38
lines changed

4 files changed

+28
-38
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ module "ad2" {
171171

172172
| Name | Source | Version |
173173
|------|--------|---------|
174-
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | github.com/Coalfire-CF/terraform-aws-securitygroup | v1.0.0 |
174+
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | github.com/Coalfire-CF/terraform-aws-securitygroup | b6e9070a3f6201d75160c42a3f649d36cb9b2622 |
175175

176176
## Resources
177177

@@ -204,17 +204,17 @@ module "ad2" {
204204
| <a name="input_associate_public_ip"></a> [associate\_public\_ip](#input\_associate\_public\_ip) | Whether or not to associate a public IP (not EIP) | `bool` | `false` | no |
205205
| <a name="input_assume_role_policy"></a> [assume\_role\_policy](#input\_assume\_role\_policy) | Policy document allowing Principals to assume this role (e.g. Trust Relationship) | `string` | `"{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Action\": \"sts:AssumeRole\",\n \"Principal\": {\n \"Service\": \"ec2.amazonaws.com\"\n },\n \"Effect\": \"Allow\",\n \"Sid\": \"\"\n }\n ]\n}\n"` | no |
206206
| <a name="input_ebs_kms_key_arn"></a> [ebs\_kms\_key\_arn](#input\_ebs\_kms\_key\_arn) | The ARN of the KMS key to encrypt EBS volumes | `string` | n/a | yes |
207-
| <a name="input_ebs_optimized"></a> [ebs\_optimized](#input\_ebs\_optimized) | Whether or not the instance is ebs optimized | `bool` | `false` | no |
207+
| <a name="input_ebs_optimized"></a> [ebs\_optimized](#input\_ebs\_optimized) | Whether or not the instance is ebs optimized | `bool` | `true` | no |
208208
| <a name="input_ebs_volumes"></a> [ebs\_volumes](#input\_ebs\_volumes) | A list of maps that must contain device\_name (ex. '/dev/sdb') and size (in GB). Optional args include type, throughput, iops, multi\_attach\_enabled, final\_snapshot, snapshot\_id, outpost\_arn, force\_detach, skip\_destroy, stop\_instance\_before\_detaching, and tags | <pre>list(object({<br> device_name = string<br> size = number<br> type = string<br> throughput = optional(number)<br> iops = optional(number)<br> multi_attach_enabled = optional(bool, false)<br> final_snapshot = optional(string)<br> snapshot_id = optional(string)<br> outpost_arn = optional(string)<br> force_detach = optional(bool, false)<br> skip_destroy = optional(bool, false)<br> stop_instance_before_detaching = optional(bool, false)<br> tags = optional(map(string), {})<br> }))</pre> | `[]` | no |
209209
| <a name="input_ec2_instance_type"></a> [ec2\_instance\_type](#input\_ec2\_instance\_type) | The type of instance to start | `string` | n/a | yes |
210210
| <a name="input_ec2_key_pair"></a> [ec2\_key\_pair](#input\_ec2\_key\_pair) | The key name to use for the instance | `string` | n/a | yes |
211-
| <a name="input_egress_rules"></a> [egress\_rules](#input\_egress\_rules) | The list of rules for egress traffic. Required fields for each rule are 'protocol', 'from\_port', 'to\_port', and at least one of 'cidr\_blocks', 'ipv6\_cidr\_blocks', 'security\_groups', 'self', or 'prefix\_list\_sg'. Optional fields are 'description' and those not used from the previous list | <pre>list(object({<br> protocol = string<br> from_port = string<br> to_port = string<br> cidr_blocks = optional(list(string), [])<br> ipv6_cidr_blocks = optional(list(string), [])<br> prefix_list_ids = optional(list(string), [])<br> security_groups = optional(list(string), [])<br> self = optional(bool)<br> description = optional(string, "Managed by Terraform")<br> }))</pre> | `[]` | no |
211+
| <a name="input_egress_rules"></a> [egress\_rules](#input\_egress\_rules) | The list of rules for egress traffic. Required fields for each rule are 'protocol', 'from\_port', 'to\_port', and at least one of 'cidr\_blocks', 'ipv6\_cidr\_blocks', 'security\_groups', 'self', or 'prefix\_list\_sg'. Optional fields are 'description' and those not used from the previous list | <pre>map(object({<br> cidr_ipv4 = optional(string, null)<br> cidr_ipv6 = optional(string, null)<br> description = optional(string, "Managed by Terraform")<br> from_port = optional(string, null)<br> ip_protocol = optional(string, null)<br> prefix_list_id = optional(string, null)<br> referenced_security_group_id = optional(string, null)<br> to_port = optional(string, null)<br> }))</pre> | `{}` | no |
212212
| <a name="input_get_password_data"></a> [get\_password\_data](#input\_get\_password\_data) | Whether or not to allow retrieval of the local admin password | `bool` | `false` | no |
213213
| <a name="input_global_tags"></a> [global\_tags](#input\_global\_tags) | a map of strings that contains global level tags | `map(string)` | n/a | yes |
214214
| <a name="input_http_tokens"></a> [http\_tokens](#input\_http\_tokens) | Whether or not the metadata service requires session tokens, required=IMDSv2, optional=IMDSv1 | `any` | `"required"` | no |
215215
| <a name="input_iam_policies"></a> [iam\_policies](#input\_iam\_policies) | A list of the iam policy ARNs to attach to the IAM role | `list(string)` | `[]` | no |
216216
| <a name="input_iam_profile"></a> [iam\_profile](#input\_iam\_profile) | A variable to attach an existing iam profile to the ec2 instance(s) created | `string` | `""` | no |
217-
| <a name="input_ingress_rules"></a> [ingress\_rules](#input\_ingress\_rules) | The list of rules for ingress traffic. Required fields for each rule are 'protocol', 'from\_port', 'to\_port', and at least one of 'cidr\_blocks', 'ipv6\_cidr\_blocks', 'security\_groups', 'self', or 'prefix\_list\_sg'. Optional fields are 'description' and those not used from the previous list | <pre>list(object({<br> protocol = string<br> from_port = string<br> to_port = string<br> cidr_blocks = optional(list(string), [])<br> ipv6_cidr_blocks = optional(list(string), [])<br> prefix_list_ids = optional(list(string), [])<br> security_groups = optional(list(string), [])<br> self = optional(bool)<br> description = optional(string, "Managed by Terraform")<br> }))</pre> | `[]` | no |
217+
| <a name="input_ingress_rules"></a> [ingress\_rules](#input\_ingress\_rules) | The list of rules for ingress traffic. Required fields for each rule are 'protocol', 'from\_port', 'to\_port', and at least one of 'cidr\_blocks', 'ipv6\_cidr\_blocks', 'security\_groups', 'self', or 'prefix\_list\_sg'. Optional fields are 'description' and those not used from the previous list | <pre>map(object({<br> cidr_ipv4 = optional(string, null)<br> cidr_ipv6 = optional(string, null)<br> description = optional(string, "Managed by Terraform")<br> from_port = optional(string, null)<br> ip_protocol = optional(string, null)<br> prefix_list_id = optional(string, null)<br> referenced_security_group_id = optional(string, null)<br> to_port = optional(string, null)<br> }))</pre> | `{}` | no |
218218
| <a name="input_instance_count"></a> [instance\_count](#input\_instance\_count) | Number of instances to launch | `number` | `1` | no |
219219
| <a name="input_keys_to_grant"></a> [keys\_to\_grant](#input\_keys\_to\_grant) | A list of kms keys to grant permissions to for the role created. | `list(string)` | `[]` | no |
220220
| <a name="input_name"></a> [name](#input\_name) | The name of the ec2 instance | `string` | n/a | yes |

ec2.tf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ resource "aws_instance" "this" {
4848
var.global_tags
4949
)
5050

51-
volume_tags = merge(
52-
{
53-
Name = var.instance_count == 1 ? var.name : "${var.name}${count.index + 1}"
54-
},
55-
var.tags,
56-
var.global_tags
57-
)
58-
5951
lifecycle {
6052
ignore_changes = [root_block_device, ebs_block_device, user_data, ami]
6153
}

sg.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module "security_group" {
2-
source = "github.com/Coalfire-CF/terraform-aws-securitygroup?ref=v1.0.0"
2+
source = "github.com/Coalfire-CF/terraform-aws-securitygroup?ref=b6e9070a3f6201d75160c42a3f649d36cb9b2622"
33

44
name = "${var.name}-sg"
55
description = var.sg_description
66
vpc_id = var.vpc_id
77

8-
ingress_rules = length(var.ingress_rules) == 0 ? null : var.ingress_rules
9-
egress_rules = length(var.egress_rules) == 0 ? null : var.egress_rules
8+
ingress_rules = length(var.ingress_rules) == 0 ? {} : var.ingress_rules
9+
egress_rules = length(var.egress_rules) == 0 ? {} : var.egress_rules
1010

1111
network_interface_resource_associations = var.additional_eni_ids
1212
}

variables.tf

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ variable "ebs_volumes" {
5858
variable "ebs_optimized" {
5959
description = "Whether or not the instance is ebs optimized"
6060
type = bool
61-
default = false
61+
default = true
6262
}
6363

6464
variable "ebs_kms_key_arn" {
@@ -114,34 +114,32 @@ variable "sg_description" {
114114

115115
variable "ingress_rules" {
116116
description = "The list of rules for ingress traffic. Required fields for each rule are 'protocol', 'from_port', 'to_port', and at least one of 'cidr_blocks', 'ipv6_cidr_blocks', 'security_groups', 'self', or 'prefix_list_sg'. Optional fields are 'description' and those not used from the previous list"
117-
type = list(object({
118-
protocol = string
119-
from_port = string
120-
to_port = string
121-
cidr_blocks = optional(list(string), [])
122-
ipv6_cidr_blocks = optional(list(string), [])
123-
prefix_list_ids = optional(list(string), [])
124-
security_groups = optional(list(string), [])
125-
self = optional(bool)
126-
description = optional(string, "Managed by Terraform")
117+
type = map(object({
118+
cidr_ipv4 = optional(string, null)
119+
cidr_ipv6 = optional(string, null)
120+
description = optional(string, "Managed by Terraform")
121+
from_port = optional(string, null)
122+
ip_protocol = optional(string, null)
123+
prefix_list_id = optional(string, null)
124+
referenced_security_group_id = optional(string, null)
125+
to_port = optional(string, null)
127126
}))
128-
default = []
127+
default = {}
129128
}
130129

131130
variable "egress_rules" {
132131
description = "The list of rules for egress traffic. Required fields for each rule are 'protocol', 'from_port', 'to_port', and at least one of 'cidr_blocks', 'ipv6_cidr_blocks', 'security_groups', 'self', or 'prefix_list_sg'. Optional fields are 'description' and those not used from the previous list"
133-
type = list(object({
134-
protocol = string
135-
from_port = string
136-
to_port = string
137-
cidr_blocks = optional(list(string), [])
138-
ipv6_cidr_blocks = optional(list(string), [])
139-
prefix_list_ids = optional(list(string), [])
140-
security_groups = optional(list(string), [])
141-
self = optional(bool)
142-
description = optional(string, "Managed by Terraform")
132+
type = map(object({
133+
cidr_ipv4 = optional(string, null)
134+
cidr_ipv6 = optional(string, null)
135+
description = optional(string, "Managed by Terraform")
136+
from_port = optional(string, null)
137+
ip_protocol = optional(string, null)
138+
prefix_list_id = optional(string, null)
139+
referenced_security_group_id = optional(string, null)
140+
to_port = optional(string, null)
143141
}))
144-
default = []
142+
default = {}
145143
}
146144

147145
variable "tags" {

0 commit comments

Comments
 (0)