Skip to content

Commit 9629fee

Browse files
authored
Merge pull request #43262 from Volatus/fix/ipam-cidr-netmask-length-diff
fix: aws_vpc_ipam_pool_cidr netmask length diff
2 parents 43b3099 + 359a727 commit 9629fee

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

.changelog/43262.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
resource/aws_vpc_ipam_pool_cidr: Fix netmask_length not being saved and diffed correctly
3+
```

internal/service/ec2/vpc_ipam_pool_cidr.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,10 @@ func resourceIPAMPoolCIDR() *schema.Resource {
8888
"netmask_length": {
8989
Type: schema.TypeInt,
9090
Optional: true,
91+
Computed: true,
9192
ForceNew: true,
9293
ValidateFunc: validation.IntBetween(0, 128),
9394
ConflictsWith: []string{"cidr"},
94-
// NetmaskLength is not outputted by GetIpamPoolCidrsOutput
95-
DiffSuppressFunc: func(k, o, n string, d *schema.ResourceData) bool {
96-
if o != "0" && n == "0" {
97-
return true
98-
}
99-
return false
100-
},
10195
},
10296
},
10397
}
@@ -171,6 +165,7 @@ func resourceIPAMPoolCIDRRead(ctx context.Context, d *schema.ResourceData, meta
171165
d.Set("cidr", output.Cidr)
172166
d.Set("ipam_pool_cidr_id", output.IpamPoolCidrId)
173167
d.Set("ipam_pool_id", poolID)
168+
d.Set("netmask_length", output.NetmaskLength)
174169

175170
return diags
176171
}

internal/service/ec2/vpc_ipam_pool_cidr_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ func TestAccIPAMPoolCIDR_basic(t *testing.T) { // nosemgrep:ci.vpc-in-test-name
4444
ResourceName: resourceName,
4545
ImportState: true,
4646
ImportStateVerify: true,
47-
ImportStateVerifyIgnore: []string{
48-
"netmask_length",
49-
},
5047
},
5148
},
5249
})
@@ -77,9 +74,6 @@ func TestAccIPAMPoolCIDR_basicNetmaskLength(t *testing.T) { // nosemgrep:ci.vpc-
7774
ResourceName: resourceName,
7875
ImportState: true,
7976
ImportStateVerify: true,
80-
ImportStateVerifyIgnore: []string{
81-
"netmask_length",
82-
},
8377
},
8478
},
8579
})

0 commit comments

Comments
 (0)