Skip to content

Commit 02ed4ef

Browse files
renovate[bot]github-actions[bot]max-lobur
authored
chore(deps): update terraform cloudposse/security-group/aws to v2 (main) (#64)
* chore(deps): update terraform cloudposse/security-group/aws to v2 * Auto-update README.md * Auto-update README.md * Update security_group.tf --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Max Lobur <[email protected]>
1 parent 3b45d7d commit 02ed4ef

File tree

6 files changed

+27
-35
lines changed

6 files changed

+27
-35
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ Available targets:
236236
| Name | Source | Version |
237237
|------|--------|---------|
238238
| <a name="module_label"></a> [label](#module\_label) | cloudposse/label/null | 0.25.0 |
239-
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | cloudposse/security-group/aws | 0.3.1 |
239+
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | cloudposse/security-group/aws | 2.2.0 |
240240
| <a name="module_ssh_key_pair"></a> [ssh\_key\_pair](#module\_ssh\_key\_pair) | cloudposse/key-pair/aws | 0.19.0 |
241241
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
242242

@@ -318,8 +318,8 @@ Available targets:
318318
| <a name="input_root_volume_type"></a> [root\_volume\_type](#input\_root\_volume\_type) | Type of root volume. Can be standard, gp2 or io1 | `string` | `"gp2"` | no |
319319
| <a name="input_security_group_description"></a> [security\_group\_description](#input\_security\_group\_description) | The Security Group description. | `string` | `"EC2 instances Security Group"` | no |
320320
| <a name="input_security_group_enabled"></a> [security\_group\_enabled](#input\_security\_group\_enabled) | Whether to create default Security Group for EC2 instances. | `bool` | `true` | no |
321-
| <a name="input_security_group_rules"></a> [security\_group\_rules](#input\_security\_group\_rules) | A list of maps of Security Group rules. <br>The values of map is fully complated with `aws_security_group_rule` resource. <br>To get more info see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule . | `list(any)` | <pre>[<br> {<br> "cidr_blocks": [<br> "0.0.0.0/0"<br> ],<br> "description": "Allow all outbound traffic",<br> "from_port": 0,<br> "protocol": "-1",<br> "to_port": 65535,<br> "type": "egress"<br> }<br>]</pre> | no |
322-
| <a name="input_security_group_use_name_prefix"></a> [security\_group\_use\_name\_prefix](#input\_security\_group\_use\_name\_prefix) | Whether to create a default Security Group with unique name beginning with the normalized prefix. | `bool` | `false` | no |
321+
| <a name="input_security_group_name"></a> [security\_group\_name](#input\_security\_group\_name) | The name to assign to the security group. Must be unique within the VPC.<br>If not provided, will be derived from the `null-label.context` passed in.<br>If `create_before_destroy` is true, will be used as a name prefix. | `list(string)` | `[]` | no |
322+
| <a name="input_security_group_rules"></a> [security\_group\_rules](#input\_security\_group\_rules) | A list of maps of Security Group rules. <br>The values of map is fully complated with `aws_security_group_rule` resource. <br>To get more info see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule . | `list(any)` | `[]` | no |
323323
| <a name="input_security_groups"></a> [security\_groups](#input\_security\_groups) | A list of Security Group IDs to associate with EC2 instances. | `list(string)` | `[]` | no |
324324
| <a name="input_source_dest_check"></a> [source\_dest\_check](#input\_source\_dest\_check) | Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs | `bool` | `true` | no |
325325
| <a name="input_ssh_key_pair"></a> [ssh\_key\_pair](#input\_ssh\_key\_pair) | SSH key pair to be provisioned on the instance | `string` | `""` | no |

docs/terraform.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
| Name | Source | Version |
1818
|------|--------|---------|
1919
| <a name="module_label"></a> [label](#module\_label) | cloudposse/label/null | 0.25.0 |
20-
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | cloudposse/security-group/aws | 0.3.1 |
20+
| <a name="module_security_group"></a> [security\_group](#module\_security\_group) | cloudposse/security-group/aws | 2.2.0 |
2121
| <a name="module_ssh_key_pair"></a> [ssh\_key\_pair](#module\_ssh\_key\_pair) | cloudposse/key-pair/aws | 0.19.0 |
2222
| <a name="module_this"></a> [this](#module\_this) | cloudposse/label/null | 0.25.0 |
2323

@@ -99,8 +99,8 @@
9999
| <a name="input_root_volume_type"></a> [root\_volume\_type](#input\_root\_volume\_type) | Type of root volume. Can be standard, gp2 or io1 | `string` | `"gp2"` | no |
100100
| <a name="input_security_group_description"></a> [security\_group\_description](#input\_security\_group\_description) | The Security Group description. | `string` | `"EC2 instances Security Group"` | no |
101101
| <a name="input_security_group_enabled"></a> [security\_group\_enabled](#input\_security\_group\_enabled) | Whether to create default Security Group for EC2 instances. | `bool` | `true` | no |
102-
| <a name="input_security_group_rules"></a> [security\_group\_rules](#input\_security\_group\_rules) | A list of maps of Security Group rules. <br>The values of map is fully complated with `aws_security_group_rule` resource. <br>To get more info see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule . | `list(any)` | <pre>[<br> {<br> "cidr_blocks": [<br> "0.0.0.0/0"<br> ],<br> "description": "Allow all outbound traffic",<br> "from_port": 0,<br> "protocol": "-1",<br> "to_port": 65535,<br> "type": "egress"<br> }<br>]</pre> | no |
103-
| <a name="input_security_group_use_name_prefix"></a> [security\_group\_use\_name\_prefix](#input\_security\_group\_use\_name\_prefix) | Whether to create a default Security Group with unique name beginning with the normalized prefix. | `bool` | `false` | no |
102+
| <a name="input_security_group_name"></a> [security\_group\_name](#input\_security\_group\_name) | The name to assign to the security group. Must be unique within the VPC.<br>If not provided, will be derived from the `null-label.context` passed in.<br>If `create_before_destroy` is true, will be used as a name prefix. | `list(string)` | `[]` | no |
103+
| <a name="input_security_group_rules"></a> [security\_group\_rules](#input\_security\_group\_rules) | A list of maps of Security Group rules. <br>The values of map is fully complated with `aws_security_group_rule` resource. <br>To get more info see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule . | `list(any)` | `[]` | no |
104104
| <a name="input_security_groups"></a> [security\_groups](#input\_security\_groups) | A list of Security Group IDs to associate with EC2 instances. | `list(string)` | `[]` | no |
105105
| <a name="input_source_dest_check"></a> [source\_dest\_check](#input\_source\_dest\_check) | Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs | `bool` | `true` | no |
106106
| <a name="input_ssh_key_pair"></a> [ssh\_key\_pair](#input\_ssh\_key\_pair) | SSH key pair to be provisioned on the instance | `string` | `""` | no |

examples/complete/main.tf

-7
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ module "ec2_instance_group" {
5959
delete_on_termination = var.delete_on_termination
6060

6161
security_group_rules = [
62-
{
63-
type = "egress"
64-
from_port = 0
65-
to_port = 65535
66-
protocol = "-1"
67-
cidr_blocks = ["0.0.0.0/0"]
68-
},
6962
{
7063
type = "ingress"
7164
from_port = 22

security_group.tf

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module "security_group" {
22
source = "cloudposse/security-group/aws"
3-
version = "0.3.1"
3+
version = "2.2.0"
44

5-
use_name_prefix = var.security_group_use_name_prefix
6-
rules = var.security_group_rules
7-
description = var.security_group_description
8-
vpc_id = var.vpc_id
5+
security_group_name = var.security_group_name
6+
rules = var.security_group_rules
7+
security_group_description = var.security_group_description
8+
vpc_id = var.vpc_id
99

1010
enabled = local.security_group_enabled
1111
context = module.this.context

test/src/examples_complete_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ func TestExamplesComplete(t *testing.T) {
5454
// Run `terraform output` to get the value of an output variable
5555
securityGroupName := terraform.Output(t, terraformOptions, "security_group_name")
5656
expectedSecurityGroupName := "eg-test-ec2-group-test-" + randId
57-
// Verify we're getting back the outputs we expect
58-
assert.Equal(t, expectedSecurityGroupName, securityGroupName)
57+
// SG name is used as a prefix in this case because we use create_before_destroy here.
58+
assert.Contains(t, securityGroupName, expectedSecurityGroupName, "Expected security_group_name to start with " + expectedSecurityGroupName)
5959

6060
// Run `terraform output` to get the value of an output variable
6161
securityGroupID := terraform.Output(t, terraformOptions, "security_group_id")

variables.tf

+14-15
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,23 @@ variable "security_group_description" {
5757
description = "The Security Group description."
5858
}
5959

60-
variable "security_group_use_name_prefix" {
61-
type = bool
62-
default = false
63-
description = "Whether to create a default Security Group with unique name beginning with the normalized prefix."
60+
variable "security_group_name" {
61+
type = list(string)
62+
description = <<-EOT
63+
The name to assign to the security group. Must be unique within the VPC.
64+
If not provided, will be derived from the `null-label.context` passed in.
65+
If `create_before_destroy` is true, will be used as a name prefix.
66+
EOT
67+
default = []
68+
validation {
69+
condition = length(var.security_group_name) < 2
70+
error_message = "Only 1 security group name can be provided."
71+
}
6472
}
6573

6674
variable "security_group_rules" {
67-
type = list(any)
68-
default = [
69-
{
70-
type = "egress"
71-
from_port = 0
72-
to_port = 65535
73-
protocol = "-1"
74-
cidr_blocks = ["0.0.0.0/0"]
75-
description = "Allow all outbound traffic"
76-
}
77-
]
75+
type = list(any)
76+
default = []
7877
description = <<-EOT
7978
A list of maps of Security Group rules.
8079
The values of map is fully complated with `aws_security_group_rule` resource.

0 commit comments

Comments
 (0)