-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Add enable_acceleration for aws_vpn_connection #12218
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,6 +109,13 @@ func resourceAwsVpnConnection() *schema.Resource { | |
ForceNew: true, | ||
}, | ||
|
||
"enable_acceleration": { | ||
Type: schema.TypeBool, | ||
Optional: true, | ||
Computed: true, | ||
ForceNew: true, | ||
}, | ||
|
||
"tunnel1_inside_cidr": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
|
@@ -291,8 +298,9 @@ func resourceAwsVpnConnectionCreate(d *schema.ResourceData, meta interface{}) er | |
} | ||
|
||
connectOpts := &ec2.VpnConnectionOptionsSpecification{ | ||
StaticRoutesOnly: aws.Bool(d.Get("static_routes_only").(bool)), | ||
TunnelOptions: options, | ||
EnableAcceleration: aws.Bool(d.Get("enable_acceleration").(bool)), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was this tested with test cases where |
||
StaticRoutesOnly: aws.Bool(d.Get("static_routes_only").(bool)), | ||
TunnelOptions: options, | ||
} | ||
|
||
createOpts := &ec2.CreateVpnConnectionInput{ | ||
|
@@ -303,6 +311,11 @@ func resourceAwsVpnConnectionCreate(d *schema.ResourceData, meta interface{}) er | |
|
||
if v, ok := d.GetOk("transit_gateway_id"); ok { | ||
createOpts.TransitGatewayId = aws.String(v.(string)) | ||
} else { | ||
// VPN Acceleration can't be enabled unless the connection's to a Transit Gateway | ||
if d.Get("enable_acceleration").(bool) { | ||
return fmt.Errorf("Error creating vpn connection: Accelerated VPN is only available for VPN connections to a Transit Gateway") | ||
} | ||
} | ||
|
||
if v, ok := d.GetOk("vpn_gateway_id"); ok { | ||
|
@@ -436,9 +449,15 @@ func resourceAwsVpnConnectionRead(d *schema.ResourceData, meta interface{}) erro | |
if err := d.Set("static_routes_only", vpnConnection.Options.StaticRoutesOnly); err != nil { | ||
return err | ||
} | ||
|
||
if err := d.Set("enable_acceleration", vpnConnection.Options.EnableAcceleration); err != nil { | ||
return err | ||
} | ||
} else { | ||
//If there no Options on the connection then we do not support *static_routes* | ||
d.Set("static_routes_only", false) | ||
//If there no Options on the connection then *enable_acceleration* is not set | ||
d.Set("enable_acceleration", false) | ||
} | ||
|
||
// Set read only attributes. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,6 +75,7 @@ One of the following arguments is required: | |
|
||
Other arguments: | ||
|
||
* `enable_acceleration` - (Optional, Default `false`) Whether the VPN connection uses acceleration. Acceleration can only be enabled on VPNs terminated on a Transit Gateway. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default |
||
* `static_routes_only` - (Optional, Default `false`) Whether the VPN connection uses static routes exclusively. Static routes must be used for devices that don't support BGP. | ||
* `tags` - (Optional) Tags to apply to the connection. | ||
* `tunnel1_inside_cidr` - (Optional) The CIDR block of the inside IP addresses for the first VPN tunnel. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is computed needed here?