From 3fd337a13d60a7280d03c7cb05ce203cfeec5d71 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 3 Feb 2022 16:06:32 -0500 Subject: [PATCH 1/6] ec2/network_acl: Remove empty validation --- internal/service/ec2/default_network_acl.go | 36 +++++++------------ internal/service/ec2/network_acl.go | 36 +++++++------------ website/docs/guides/version-4-upgrade.html.md | 30 ++++++++++++++++ 3 files changed, 54 insertions(+), 48 deletions(-) diff --git a/internal/service/ec2/default_network_acl.go b/internal/service/ec2/default_network_acl.go index aff48e9887ab..a019ca9044c6 100644 --- a/internal/service/ec2/default_network_acl.go +++ b/internal/service/ec2/default_network_acl.go @@ -97,20 +97,14 @@ func ResourceDefaultNetworkACL() *schema.Resource { Required: true, }, "cidr_block": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.Any( - validation.StringIsEmpty, - validation.IsCIDR, - ), + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.IsCIDR, }, "ipv6_cidr_block": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.Any( - validation.StringIsEmpty, - validation.IsCIDR, - ), + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.IsCIDR, }, "icmp_type": { Type: schema.TypeInt, @@ -157,20 +151,14 @@ func ResourceDefaultNetworkACL() *schema.Resource { Required: true, }, "cidr_block": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.Any( - validation.StringIsEmpty, - validation.IsCIDR, - ), + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.IsCIDR, }, "ipv6_cidr_block": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.Any( - validation.StringIsEmpty, - validation.IsCIDR, - ), + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.IsCIDR, }, "icmp_type": { Type: schema.TypeInt, diff --git a/internal/service/ec2/network_acl.go b/internal/service/ec2/network_acl.go index 7a0be1f53ea8..6a65d6c7589a 100644 --- a/internal/service/ec2/network_acl.go +++ b/internal/service/ec2/network_acl.go @@ -88,20 +88,14 @@ func ResourceNetworkACL() *schema.Resource { Required: true, }, "cidr_block": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.Any( - validation.StringIsEmpty, - validation.IsCIDR, - ), + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.IsCIDR, }, "ipv6_cidr_block": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.Any( - validation.StringIsEmpty, - validation.IsCIDR, - ), + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.IsCIDR, }, "icmp_type": { Type: schema.TypeInt, @@ -153,20 +147,14 @@ func ResourceNetworkACL() *schema.Resource { Required: true, }, "cidr_block": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.Any( - validation.StringIsEmpty, - validation.IsCIDR, - ), + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.IsCIDR, }, "ipv6_cidr_block": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.Any( - validation.StringIsEmpty, - validation.IsCIDR, - ), + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.IsCIDR, }, "icmp_type": { Type: schema.TypeInt, diff --git a/website/docs/guides/version-4-upgrade.html.md b/website/docs/guides/version-4-upgrade.html.md index 5d38f88f3f0d..ff7ddbff5636 100644 --- a/website/docs/guides/version-4-upgrade.html.md +++ b/website/docs/guides/version-4-upgrade.html.md @@ -32,6 +32,7 @@ Upgrade topics: - [Resource: aws_batch_compute_environment](#resource-aws_batch_compute_environment) - [Resource: aws_cloudwatch_event_target](#resource-aws_cloudwatch_event_target) - [Resource: aws_customer_gateway](#resource-aws_customer_gateway) +- [Resource: aws_default_network_acl](#resource-aws_default_network_acl) - [Resource: aws_elasticache_cluster](#resource-aws_elasticache_cluster) - [Resource: aws_elasticache_global_replication_group](#resource-aws_elasticache_global_replication_group) - [Resource: aws_elasticache_replication_group](#resource-aws_elasticache_replication_group) @@ -411,6 +412,35 @@ resource "aws_cloudwatch_event_target" "test" { Previously, `ip_address` could be set to `""`, which would result in an AWS error. However, this value is no longer accepted by the provider. +## Resource: aws_default_network_acl + +Previously, `egress.*.cidr_block`, `egress.*.ipv6_cidr_block`, `ingress.*.cidr_block`, or `ingress.*.ipv6_cidr_block` could be set to `""`. However, the value `""` is no longer valid. + +For example, previously this type of configuration was valid: + +```terraform +resource "aws_default_network_acl" "default" { + // ... + egress { + cidr_block = "0.0.0.0/0" + ipv6_cidr_block = "" + // ... + } +} +``` + +Now, simply remove the empty-value configuration: + +```terraform +resource "aws_default_network_acl" "default" { + // ... + egress { + cidr_block = "0.0.0.0/0" + // ... + } +} +``` + ## Resource: aws_elasticache_cluster ### Error raised if neither `engine` nor `replication_group_id` is specified From 85e22206784b3e523428bc9a5a8fe4db999bec2b Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 3 Feb 2022 16:09:29 -0500 Subject: [PATCH 2/6] Add changelog --- .changelog/22928.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/22928.txt diff --git a/.changelog/22928.txt b/.changelog/22928.txt new file mode 100644 index 000000000000..f3c4e17fa63e --- /dev/null +++ b/.changelog/22928.txt @@ -0,0 +1,3 @@ +```release-note:breaking-change +resource/aws_default_network_acl: These arguments can no longer be set to `""`: `egress.*.cidr_block`, `egress.*.ipv6_cidr_block`, `ingress.*.cidr_block`, or `ingress.*.ipv6_cidr_block` +``` From 5456190fd7f8218d80939dd92e362584c4faef46 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 3 Feb 2022 16:11:36 -0500 Subject: [PATCH 3/6] Update docs, changelog --- .changelog/22928.txt | 4 +++ website/docs/guides/version-4-upgrade.html.md | 30 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/.changelog/22928.txt b/.changelog/22928.txt index f3c4e17fa63e..4db0975cd1e0 100644 --- a/.changelog/22928.txt +++ b/.changelog/22928.txt @@ -1,3 +1,7 @@ ```release-note:breaking-change resource/aws_default_network_acl: These arguments can no longer be set to `""`: `egress.*.cidr_block`, `egress.*.ipv6_cidr_block`, `ingress.*.cidr_block`, or `ingress.*.ipv6_cidr_block` ``` + +```release-note:breaking-change +resource/aws_network_acl: These arguments can no longer be set to `""`: `egress.*.cidr_block`, `egress.*.ipv6_cidr_block`, `ingress.*.cidr_block`, or `ingress.*.ipv6_cidr_block` +``` \ No newline at end of file diff --git a/website/docs/guides/version-4-upgrade.html.md b/website/docs/guides/version-4-upgrade.html.md index ff7ddbff5636..a94306a10754 100644 --- a/website/docs/guides/version-4-upgrade.html.md +++ b/website/docs/guides/version-4-upgrade.html.md @@ -37,6 +37,7 @@ Upgrade topics: - [Resource: aws_elasticache_global_replication_group](#resource-aws_elasticache_global_replication_group) - [Resource: aws_elasticache_replication_group](#resource-aws_elasticache_replication_group) - [Resource: aws_fsx_ontap_storage_virtual_machine](#resource-aws_fsx_ontap_storage_virtual_machine) +- [Resource: aws_network_acl](#resource-aws_network_acl) - [Resource: aws_network_interface](#resource-aws_network_interface) - [Resource: aws_s3_bucket](#resource-aws_s3_bucket) - [Resource: aws_s3_bucket_object](#resource-aws_s3_bucket_object) @@ -499,6 +500,35 @@ output "elasticache_global_replication_group_version_result" { We removed the misspelled argument `active_directory_configuration.0.self_managed_active_directory_configuration.0.organizational_unit_distinguidshed_name` that was previously deprecated. Use `active_directory_configuration.0.self_managed_active_directory_configuration.0.organizational_unit_distinguished_name` now instead. Terraform will automatically migrate the state to `active_directory_configuration.0.self_managed_active_directory_configuration.0.organizational_unit_distinguished_name` during planning. +## Resource: aws_network_acl + +Previously, `egress.*.cidr_block`, `egress.*.ipv6_cidr_block`, `ingress.*.cidr_block`, or `ingress.*.ipv6_cidr_block` could be set to `""`. However, the value `""` is no longer valid. + +For example, previously this type of configuration was valid: + +```terraform +resource "aws_network_acl" "default" { + // ... + egress { + cidr_block = "0.0.0.0/0" + ipv6_cidr_block = "" + // ... + } +} +``` + +Now, simply remove the empty-value configuration: + +```terraform +resource "aws_network_acl" "default" { + // ... + egress { + cidr_block = "0.0.0.0/0" + // ... + } +} +``` + ## Resource: aws_network_interface !> **WARNING:** This topic is placeholder documentation. From 51e7fc7bc8598852197dbdcec0e096cafcd295fd Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 3 Feb 2022 16:37:45 -0500 Subject: [PATCH 4/6] Add info to docs --- website/docs/guides/version-4-upgrade.html.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/docs/guides/version-4-upgrade.html.md b/website/docs/guides/version-4-upgrade.html.md index a94306a10754..d78edf77b43a 100644 --- a/website/docs/guides/version-4-upgrade.html.md +++ b/website/docs/guides/version-4-upgrade.html.md @@ -508,16 +508,16 @@ For example, previously this type of configuration was valid: ```terraform resource "aws_network_acl" "default" { - // ... + # ... egress { cidr_block = "0.0.0.0/0" ipv6_cidr_block = "" - // ... + # ... } } ``` -Now, simply remove the empty-value configuration: +Now, set the argument to null (`ipv6_cidr_block = null`) or simply remove the empty-value configuration: ```terraform resource "aws_network_acl" "default" { From dcd6ab6518c03d378f13923be5eed80b17c642b3 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 3 Feb 2022 16:38:59 -0500 Subject: [PATCH 5/6] Add info to docs --- website/docs/guides/version-4-upgrade.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/guides/version-4-upgrade.html.md b/website/docs/guides/version-4-upgrade.html.md index d78edf77b43a..0880ec1337fc 100644 --- a/website/docs/guides/version-4-upgrade.html.md +++ b/website/docs/guides/version-4-upgrade.html.md @@ -430,7 +430,7 @@ resource "aws_default_network_acl" "default" { } ``` -Now, simply remove the empty-value configuration: +Now, set the argument to null (`ipv6_cidr_block = null`) or simply remove the empty-value configuration: ```terraform resource "aws_default_network_acl" "default" { From 0ea4823c82dfa8e60fc7d325dd43c7682fae7146 Mon Sep 17 00:00:00 2001 From: Dirk Avery Date: Thu, 3 Feb 2022 16:40:14 -0500 Subject: [PATCH 6/6] Fix comments --- website/docs/guides/version-4-upgrade.html.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/website/docs/guides/version-4-upgrade.html.md b/website/docs/guides/version-4-upgrade.html.md index 0880ec1337fc..910849c4b464 100644 --- a/website/docs/guides/version-4-upgrade.html.md +++ b/website/docs/guides/version-4-upgrade.html.md @@ -421,11 +421,11 @@ For example, previously this type of configuration was valid: ```terraform resource "aws_default_network_acl" "default" { - // ... + # ... egress { cidr_block = "0.0.0.0/0" ipv6_cidr_block = "" - // ... + # ... } } ``` @@ -434,10 +434,10 @@ Now, set the argument to null (`ipv6_cidr_block = null`) or simply remove the em ```terraform resource "aws_default_network_acl" "default" { - // ... + # ... egress { cidr_block = "0.0.0.0/0" - // ... + # ... } } ``` @@ -521,10 +521,10 @@ Now, set the argument to null (`ipv6_cidr_block = null`) or simply remove the em ```terraform resource "aws_network_acl" "default" { - // ... + # ... egress { cidr_block = "0.0.0.0/0" - // ... + # ... } } ```