Skip to content

Commit

Permalink
- Use null as default to preserve current settings and when removin…
Browse files Browse the repository at this point in the history
…g default control
  • Loading branch information
bryantbiggs committed Jun 20, 2020
1 parent 5fbcb24 commit 6881b92
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ It is possible to integrate this VPC module with [terraform-aws-transit-gateway
| default\_network\_acl\_name | Name to be used on the Default Network ACL | `string` | `""` | no |
| default\_network\_acl\_tags | Additional tags for the Default Network ACL | `map(string)` | `{}` | no |
| 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 |
| 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 |
| default\_security\_group\_name | Name to be used on the default security group | `string` | `""` | no |
| default\_security\_group\_ingress | List of maps of ingress rules to set on the default security group | `list(map(string))` | `null` | no |
| default\_security\_group\_name | Name to be used on the default security group | `string` | `"default"` | no |
| default\_security\_group\_tags | Additional tags for the default security group | `map(string)` | `{}` | no |
| default\_vpc\_enable\_classiclink | Should be true to enable ClassicLink in the Default VPC | `bool` | `false` | no |
| default\_vpc\_enable\_dns\_hostnames | Should be true to enable DNS hostnames in the Default VPC | `bool` | `false` | no |
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ resource "aws_vpc_ipv4_cidr_block_association" "this" {
resource "aws_default_security_group" "this" {
count = var.create_vpc && var.manage_default_security_group ? 1 : 0

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

dynamic "ingress" {
for_each = var.default_security_group_ingress
Expand Down
12 changes: 2 additions & 10 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2268,21 +2268,13 @@ variable "manage_default_security_group" {
variable "default_security_group_name" {
description = "Name to be used on the default security group"
type = string
default = ""
default = "default"
}

variable "default_security_group_ingress" {
description = "List of maps of ingress rules to set on the default security group"
type = list(map(string))

default = [
{
self = true
from_port = 0
to_port = 0
protocol = "-1"
}
]
default = null
}

variable "enable_flow_log" {
Expand Down

0 comments on commit 6881b92

Please sign in to comment.