Skip to content

Commit ccbe075

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

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
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 |
317317
| 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 |
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` | `null` | 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: 2 additions & 10 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 = null
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" {

0 commit comments

Comments
 (0)