Closed as not planned
Closed as not planned
Description
Terraform Core Version
1.4.5
AWS Provider Version
4.64.0
Affected Resource(s)
aws_subnet (enable_lni_at_device_index)
Expected Behavior
When I specify a subnet without enable_lni_at_device_index
, the ModifySubnetAttribute API call should include DisableLniAtDeviceIndex
parameter, and it should succeed.
Actual Behavior
Terraform fails with an error.
Relevant Error/Panic Output Snippet
│ Error: modifying EC2 Subnet (subnet-xxx) EnableLniAtDeviceIndex: InvalidParameterValue: lni-at-device-index must be less than or equal to 64 and greater than or equal to 1
│ status code: 400, request id: xxx
│
│ with aws_subnet.xxx,
│ on xxx.tf line 1, in resource "aws_subnet" "xxx":
│ 1: resource "aws_subnet" "xxx" {
│
╵
Error: Terraform exited with code 1.
Error: Process completed with exit code 1.
Terraform Configuration Files
resource "aws_subnet" "xxx" {
vpc_id = xxx
outpost_arn = xxx
cidr_block = "10.0.0.0/24"
assign_ipv6_address_on_creation = true
ipv6_cidr_block = xxx
private_dns_hostname_type_on_launch = "resource-name"
enable_resource_name_dns_a_record_on_launch = true
enable_resource_name_dns_aaaa_record_on_launch = true
# note that enable_lni_at_device_index is not set
}
Steps to Reproduce
- Manually create a subnet
- Use AWS CLI to set lni_at_device_index to be 1:
aws ec2 modify-subnet-attribute --subnet-id subnet-xxx --enable-lni-at-device-index 1
- Apply the terraform config above
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifySubnetAttribute.html
When the LNI attribute needs to be cleared, the request should have DisableLniAtDeviceIndex
set to true.
Would you like to implement a fix?
None