Skip to content

Commit dca165a

Browse files
committed
- Use null as default to preserve current settings and when removing default control
1 parent 5fbcb24 commit dca165a

File tree

3 files changed

+7
-23
lines changed

3 files changed

+7
-23
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
314314
| default\_network\_acl\_ingress | List of maps of ingress rules to set on the Default Network ACL | `list(map(string))` | <pre>[<br> {<br> "action": "allow",<br> "cidr_block": "0.0.0.0/0",<br> "from_port": 0,<br> "protocol": "-1",<br> "rule_no": 100,<br> "to_port": 0<br> },<br> {<br> "action": "allow",<br> "from_port": 0,<br> "ipv6_cidr_block": "::/0",<br> "protocol": "-1",<br> "rule_no": 101,<br> "to_port": 0<br> }<br>]</pre> | no |
315315
| default\_network\_acl\_name | Name to be used on the Default Network ACL | `string` | `""` | no |
316316
| default\_network\_acl\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |
317-
| default\_security\_group\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | <pre>[<br> {<br> "cidr_blocks": "0.0.0.0/0",<br> "from_port": 0,<br> "protocol": "-1",<br> "to_port": 0<br> }<br>]</pre> | no |
318-
| default\_security\_group\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | <pre>[<br> {<br> "from_port": 0,<br> "protocol": "-1",<br> "self": true,<br> "to_port": 0<br> }<br>]</pre> | no |
319-
| default\_security\_group\_name | Name to be used on the default security group | `string` | `""` | no |
317+
| default\_security\_group\_egress | List of maps of egress rules to set on the default security group | `list(map(string))` | `null` | no |
318+
| default\_security\_group\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |
319+
| default\_security\_group\_name | Name to be used on the default security group | `string` | `"default"` | no |
320320
| default\_security\_group\_tags | Additional tags for the default security group | `map(string)` | `{}` | no |
321321
| default\_vpc\_enable\_classiclink | Should be true to enable ClassicLink in the Default VPC | `bool` | `false` | no |
322322
| default\_vpc\_enable\_dns\_hostnames | Should be true to enable DNS hostnames in the Default VPC | `bool` | `false` | no |

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ resource "aws_vpc_ipv4_cidr_block_association" "this" {
5757
resource "aws_default_security_group" "this" {
5858
count = var.create_vpc && var.manage_default_security_group ? 1 : 0
5959

60-
vpc_id = element(concat(aws_vpc.this.*.id, [""]), 0)
60+
vpc_id = aws_vpc.this[0].id
6161

6262
dynamic "ingress" {
6363
for_each = var.default_security_group_ingress

variables.tf

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2268,21 +2268,13 @@ variable "manage_default_security_group" {
22682268
variable "default_security_group_name" {
22692269
description = "Name to be used on the default security group"
22702270
type = string
2271-
default = ""
2271+
default = "default"
22722272
}
22732273

22742274
variable "default_security_group_ingress" {
22752275
description = "List of maps of ingress rules to set on the default security group"
22762276
type = list(map(string))
2277-
2278-
default = [
2279-
{
2280-
self = true
2281-
from_port = 0
2282-
to_port = 0
2283-
protocol = "-1"
2284-
}
2285-
]
2277+
default = null
22862278
}
22872279

22882280
variable "enable_flow_log" {
@@ -2294,15 +2286,7 @@ variable "enable_flow_log" {
22942286
variable "default_security_group_egress" {
22952287
description = "List of maps of egress rules to set on the default security group"
22962288
type = list(map(string))
2297-
2298-
default = [
2299-
{
2300-
cidr_blocks = "0.0.0.0/0"
2301-
from_port = 0
2302-
to_port = 0
2303-
protocol = "-1"
2304-
}
2305-
]
2289+
default = null
23062290
}
23072291

23082292
variable "default_security_group_tags" {

0 commit comments

Comments
 (0)