terraform -v
Terraform v0.11.8
+ provider.aws v1.36.0
provider "aws" {
region = "us-east-1"
}
resource "aws_waf_ipset" "ipset" {
name = "test-ipset"
ip_set_descriptors = [
{
type = "IPV4"
value = "192.0.7.0/24"
},
{
value = "2600:123:1020:2111::/64"
type = "IPV6"
},
{
value = "2600:123:1020:2881::/64"
type = "IPV6"
},
]
}
Not needed, as could be easily reproduced
Second run of terraform plan (after terraform apply) should show not difference. Instead it shows difference every time.
Terraform creating plans on every run. Only difference is a format of v6 address (full with compact) what indicates that ipv6 addresses are not compared correctly:
$ terraform apply
aws_waf_ipset.ipset: Refreshing state... (ID: 914d0092-1b68-4996-b63b-13e01318ff1b)
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
~ aws_waf_ipset.ipset
ip_set_descriptors.2937190556.type: "" => "IPV6"
ip_set_descriptors.2937190556.value: "" => "2600:123:1020:2881::/64"
ip_set_descriptors.3390743040.type: "IPV6" => ""
ip_set_descriptors.3390743040.value: "2600:0123:1020:2881:0000:0000:0000:0000/64" => ""
ip_set_descriptors.3558925536.type: "IPV6" => ""
ip_set_descriptors.3558925536.value: "2600:0123:1020:2111:0000:0000:0000:0000/64" => ""
ip_set_descriptors.4037960608.type: "IPV4" => "IPV4"
ip_set_descriptors.4037960608.value: "192.0.7.0/24" => "192.0.7.0/24"
ip_set_descriptors.486364652.type: "" => "IPV6"
ip_set_descriptors.486364652.value: "" => "2600:123:1020:2111::/64"
terraform applyterraform applyterraform applyShould be reproducible on any account. If i am using full format of ip address terraform works as expected.
https://tools.ietf.org/html/rfc1884#page-4
In fact same apply to ipv4 address if written with leading 0. E.g. 10.0.1.01
@bflad I'm looking into this, and the only way I found to solve this is overriding the Set SchemaSetFunc to normalise the unique ID of the ip_set_descriptor, is this the right solution to fix this and won't this cause a breaking change ?.
I looked into overriding SchemaDiffSuppressFunc but couldn't get it to work, probably because of the schema.TypeSet.
We are seeing the exact same thing. Pretty annoying but not a blocker for us.
There is a workaround :
Write every CIDR block as AWS outputs them :
0 ( E.G. 10.0.1.1 instead of 10.0.1.01 to quote @samm-git )0 ( E.G. 2600:0123:1020:2881:0000:0000:0000:0000 instead of 2600:123:1020:2881 to quote O.P. )
Most helpful comment
There is a workaround :
Write every CIDR block as AWS outputs them :
0( E.G.10.0.1.1instead of10.0.1.01to quote @samm-git )0( E.G.2600:0123:1020:2881:0000:0000:0000:0000instead of2600:123:1020:2881to quote O.P. )