Skip to content

Commit

Permalink
Add wait_for_ipam_deallocation param
Browse files Browse the repository at this point in the history
  • Loading branch information
p-hash committed Nov 29, 2023
1 parent 7f0a732 commit 05a271d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/service/ec2/vpc_.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ func ResourceVPC() *schema.Resource {
ConflictsWith: []string{"ipv6_cidr_block"},
RequiredWith: []string{"ipv6_ipam_pool_id"},
},
"wait_for_ipam_deallocation": {
Type: schema.TypeBool,
Optional: true,
Default: true,
},
"main_route_table_id": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -480,7 +485,9 @@ func resourceVPCDelete(ctx context.Context, d *schema.ResourceData, meta interfa
ipamPoolID = v.(string)
}
}
if ipamPoolID != "" && ipamPoolID != amazonIPv6PoolID {
var wait_for_ipam_deallocation = d.Get("wait_for_ipam_deallocation").(bool)
log.Printf("[INFO] Should wait for IPAM: %s", wait_for_ipam_deallocation)
if ipamPoolID != "" && ipamPoolID != amazonIPv6PoolID && wait_for_ipam_deallocation {
const (
timeout = 20 * time.Minute // IPAM eventual consistency
)
Expand Down
5 changes: 5 additions & 0 deletions internal/service/ec2/vpc_default_vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ func ResourceDefaultVPC() *schema.Resource {
ConflictsWith: []string{"ipv6_cidr_block"},
RequiredWith: []string{"ipv6_ipam_pool_id"},
},
"wait_for_ipam_deallocation": {
Type: schema.TypeBool,
Optional: true,
Default: true,
},
"main_route_table_id": {
Type: schema.TypeString,
Computed: true,
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/vpc.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ This resource supports the following arguments:
* `ipv6_ipam_pool_id` - (Optional) IPAM Pool ID for a IPv6 pool. Conflicts with `assign_generated_ipv6_cidr_block`.
* `ipv6_netmask_length` - (Optional) Netmask length to request from IPAM Pool. Conflicts with `ipv6_cidr_block`. This can be omitted if IPAM pool as a `allocation_default_netmask_length` set. Valid values: `56`.
* `ipv6_cidr_block_network_border_group` - (Optional) By default when an IPv6 CIDR is assigned to a VPC a default ipv6_cidr_block_network_border_group will be set to the region of the VPC. This can be changed to restrict advertisement of public addresses to specific Network Border Groups such as LocalZones.
* `wait_for_ipam_deallocation` - (Optional) A boolean flag to enable/disable waiting for IPAM deallocation on VPC destroy. Defaults to true.
* `enable_dns_support` - (Optional) A boolean flag to enable/disable DNS support in the VPC. Defaults to true.
* `enable_network_address_usage_metrics` - (Optional) Indicates whether Network Address Usage metrics are enabled for your VPC. Defaults to false.
* `enable_dns_hostnames` - (Optional) A boolean flag to enable/disable DNS hostnames in the VPC. Defaults false.
Expand Down

0 comments on commit 05a271d

Please sign in to comment.