-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Terraform Core Version
1.5.4
AWS Provider Version
5.40.0
Affected Resource(s)
aws_ec2_transit_gateway
Expected Behavior
Terraform should have recognize a 32-bit ASN number configured in the AWS TGW resource.
Actual Behavior
Tried to import an AWS TGW created manually to Terraform state using import resource block. The TGW has a 32-bit ASN configured:
resource "aws_ec2_transit_gateway" "example_name" {
amazon_side_asn = "4288888251"
auto_accept_shared_attachments = "disable"
default_route_table_association = "disable"
default_route_table_propagation = "disable"
multicast_support = "disable"
}
import {
to = aws_ec2_transit_gateway.example_name
id = "tgw-123456789"
}
Got this error:
Error: Attribute must be a whole number, got 4.288888251e+09
with aws_ec2_transit_gateway.tgw-network-ww-prod-use2,
on tgw_file_name.tf line 47, in resource "aws_ec2_transit_gateway" "example_name":
47: amazon_side_asn = "4288888251"
I removed the ASN in the resource configuration block and realized that the 32-bit ASN number was converted to some negative integer number:
# aws_ec2_transit_gateway.example_name will be updated in-place
# (imported from "tgw-123456789")
~ resource "aws_ec2_transit_gateway" "example_name" {
~ amazon_side_asn = -6079045 -> 64512
arn = "<ARN>"
auto_accept_shared_attachments = "disable"
default_route_table_association = "disable"
default_route_table_propagation = "disable"
dns_support = "enable"
id = "tgw-123456789"
multicast_support = "disable"
owner_id = "<ACCOUNT ID>"
vpn_ecmp_support = "enable"
}
I changed the resource block to match this "amazon_side_asn" = -6079045 and it the import worked fine. In the AWS console, it's still showing as the ASN 4288888251.
Relevant Error/Panic Output Snippet
No response
Terraform Configuration Files
resource "aws_ec2_transit_gateway" "example_name" {
amazon_side_asn = "4288888251"
auto_accept_shared_attachments = "disable"
default_route_table_association = "disable"
default_route_table_propagation = "disable"
multicast_support = "disable"
}
import {
to = aws_ec2_transit_gateway.example_name
id = "tgw-123456789"
}
Steps to Reproduce
Use import block to have a manually created AWS TGW in the Terraform state.
Make sure the AWS TGW has a 32-bit ASN number configured.
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
None