Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/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 #34420

Merged
merged 5 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/34420.txt
Original file line number Diff line number Diff line change
@@ -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
```
9 changes: 3 additions & 6 deletions internal/service/ec2/vpnsite_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func ResourceVPNConnection() *schema.Resource {
ReadWithoutTimeout: resourceVPNConnectionRead,
UpdateWithoutTimeout: resourceVPNConnectionUpdate,
DeleteWithoutTimeout: resourceVPNConnectionDelete,

Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
Expand All @@ -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,
},
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
112 changes: 64 additions & 48 deletions internal/service/ec2/vpnsite_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
},
})
Expand Down Expand Up @@ -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"},
},
},
})
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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"},
},
},
})
Expand Down Expand Up @@ -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"},
},
},
})
Expand All @@ -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"},
},
},
})
Expand All @@ -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"},
},
},
})
Expand All @@ -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"},
},
},
})
Expand All @@ -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"},
},
},
})
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down
Loading