diff --git a/.changelog/34420.txt b/.changelog/34420.txt new file mode 100644 index 00000000000..871fe413583 --- /dev/null +++ b/.changelog/34420.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_vpn_connection: Fix `UnsupportedOperation: The tunnel inside ip version parameter is not currently supported in this region` error when creating connections in certain partitions and Regions +``` \ No newline at end of file diff --git a/internal/service/ec2/vpnsite_connection.go b/internal/service/ec2/vpnsite_connection.go index ed816741103..e34dd9e768b 100644 --- a/internal/service/ec2/vpnsite_connection.go +++ b/internal/service/ec2/vpnsite_connection.go @@ -38,6 +38,7 @@ func ResourceVPNConnection() *schema.Resource { ReadWithoutTimeout: resourceVPNConnectionRead, UpdateWithoutTimeout: resourceVPNConnectionUpdate, DeleteWithoutTimeout: resourceVPNConnectionDelete, + Importer: &schema.ResourceImporter{ StateContext: schema.ImportStatePassthroughContext, }, @@ -47,11 +48,11 @@ func ResourceVPNConnection() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "core_network_arn": { + "core_network_attachment_arn": { Type: schema.TypeString, Computed: true, }, - "core_network_attachment_arn": { + "core_network_arn": { Type: schema.TypeString, Computed: true, }, @@ -696,7 +697,6 @@ func resourceVPNConnectionCreate(ctx context.Context, d *schema.ResourceData, me input.VpnGatewayId = aws.String(v.(string)) } - log.Printf("[DEBUG] Creating EC2 VPN Connection: %s", input) output, err := conn.CreateVpnConnectionWithContext(ctx, input) if err != nil { @@ -922,7 +922,6 @@ func resourceVPNConnectionUpdate(ctx context.Context, d *schema.ResourceData, me VpnTunnelOutsideIpAddress: aws.String(address), } - log.Printf("[DEBUG] Modifying EC2 VPN Connection tunnel (%d) options: %s", i+1, input) _, err := conn.ModifyVpnTunnelOptionsWithContext(ctx, input) if err != nil { @@ -991,8 +990,6 @@ func expandVPNConnectionOptionsSpecification(d *schema.ResourceData) *ec2.VpnCon if v, ok := d.GetOk("remote_ipv4_network_cidr"); ok { apiObject.RemoteIpv4NetworkCidr = aws.String(v.(string)) } - - apiObject.TunnelInsideIpVersion = aws.String(ec2.TunnelInsideIpVersionIpv4) } if v, ok := d.GetOk("static_routes_only"); ok { diff --git a/internal/service/ec2/vpnsite_connection_test.go b/internal/service/ec2/vpnsite_connection_test.go index 2e8b81a4291..9c1b2289149 100644 --- a/internal/service/ec2/vpnsite_connection_test.go +++ b/internal/service/ec2/vpnsite_connection_test.go @@ -242,9 +242,10 @@ func TestAccSiteVPNConnection_basic(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, }, }) @@ -336,9 +337,10 @@ func TestAccSiteVPNConnection_withoutTGWorVGW(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, }, }) @@ -372,9 +374,10 @@ func TestAccSiteVPNConnection_cloudWatchLogOptions(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, { Config: testAccSiteVPNConnectionConfig_cloudWatchLogOptionsUpdated(rName, rBgpAsn), @@ -416,9 +419,10 @@ func TestAccSiteVPNConnection_transitGatewayID(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, }, }) @@ -1229,9 +1233,10 @@ func TestAccSiteVPNConnection_staticRoutes(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, }, }) @@ -1258,9 +1263,10 @@ func TestAccSiteVPNConnection_outsideAddressTypePrivate(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, }, }) @@ -1287,9 +1293,10 @@ func TestAccSiteVPNConnection_outsideAddressTypePublic(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, }, }) @@ -1316,9 +1323,10 @@ func TestAccSiteVPNConnection_enableAcceleration(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, }, }) @@ -1344,9 +1352,10 @@ func TestAccSiteVPNConnection_ipv6(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, }, }) @@ -1374,9 +1383,10 @@ func TestAccSiteVPNConnection_tags(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, { Config: testAccSiteVPNConnectionConfig_tags2(rName, rBgpAsn, "key1", "value1updated", "key2", "value2"), @@ -1421,9 +1431,10 @@ func TestAccSiteVPNConnection_specifyIPv4(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, { Config: testAccSiteVPNConnectionConfig_localRemoteIPv4CIDRs(rName, rBgpAsn, "10.112.0.0/16", "10.222.32.0/24"), @@ -1509,9 +1520,10 @@ func TestAccSiteVPNConnection_updateCustomerGatewayID(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, { Config: testAccSiteVPNConnectionConfig_customerGatewayIDUpdated(rName, rBgpAsn1, rBgpAsn2), @@ -1546,9 +1558,10 @@ func TestAccSiteVPNConnection_updateVPNGatewayID(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, { Config: testAccSiteVPNConnectionConfig_vpnGatewayIDUpdated(rName, rBgpAsn), @@ -1584,9 +1597,10 @@ func TestAccSiteVPNConnection_updateTransitGatewayID(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, { Config: testAccSiteVPNConnectionConfig_transitGatewayIDUpdated(rName, rBgpAsn), @@ -1623,9 +1637,10 @@ func TestAccSiteVPNConnection_vpnGatewayIDToTransitGatewayID(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, { Config: testAccSiteVPNConnectionConfig_transitGatewayIDOrVPNGatewayID(rName, rBgpAsn, true), @@ -1662,9 +1677,10 @@ func TestAccSiteVPNConnection_transitGatewayIDToVPNGatewayID(t *testing.T) { ), }, { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"vgw_telemetry"}, }, { Config: testAccSiteVPNConnectionConfig_transitGatewayIDOrVPNGatewayID(rName, rBgpAsn, false),