hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.61k stars 9k forks source link

[Enhancement]: IPAM subnet reservations #34615

Open drewmullen opened 7 months ago

drewmullen commented 7 months ago

Description

AWS Announced VPC Subnets can get their CIDR from AWS IPAM IP Reservations. I'm not 100% what the implementation will look like but will update this issue as the service features become available publicly.

Based on the blog I believe the following changes need to be made

  1. aws_vpc_ipam_pool needs to be able to set resource planning to a vpc
  2. aws_subnet needs to specify the cidr block is from an ipam pool id, ip netmask

These values are

Affected Resource(s) and/or Data Source(s)

Potential Terraform Configuration

### ipam pool

resource aws_vpc_ipam_pool main {
  source_resource {

    resource_id = <>

    resource_owner = <> # account owner id

    resource_region = <>

    // The source resource type.
    ResourceType = "vpc" # https://github.com/aws/aws-sdk-go-v2/blob/main/service/ec2/types/enums.go#L4776

  }
}

### vpc subnet

```hcl
resource aws_subnet main {
  ipv4_ipam_pool_id = ""
  ipv6_ipam_pool_id = ""

  ipv4_netmask_length = #
  ipv6_netmask_length = #
}


### References

_No response_

### Would you like to implement a fix?

None
github-actions[bot] commented 7 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

drewmullen commented 7 months ago

To confirm design I need to try this out with CLI commands. The docs arent updated yet because #reinvent

laminarcode commented 1 month ago

API documentation now available: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSubnet.html Kindly implement the following attributes in terraform: