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

resource/aws_dx_private_virtual_interface: Update resource to support MTU param #6141

Merged
merged 18 commits into from
Oct 30, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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
16 changes: 16 additions & 0 deletions aws/resource_aws_dx_private_virtual_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ func resourceAwsDxPrivateVirtualInterface() *schema.Resource {
Computed: true,
ForceNew: true,
},
"mtu": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type: schema.TypeInt,
Optional: true,
Computed: true,
ForceNew: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
"jumbo_frame_enabled": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick - In the documentation the feature is called Jumbo Frames. For consistency I suggest naming the attribute jumbo_frames_enabled or jumbo_frame_capable (to match the API).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I meant to have this match the API but I just spaced on it. This will be corrected in my next commit.

Type: schema.TypeBool,
Computed: true,
},
"tags": tagsSchema(),
},

Expand Down Expand Up @@ -111,6 +121,7 @@ func resourceAwsDxPrivateVirtualInterfaceCreate(d *schema.ResourceData, meta int
Vlan: aws.Int64(int64(d.Get("vlan").(int))),
Asn: aws.Int64(int64(d.Get("bgp_asn").(int))),
AddressFamily: aws.String(d.Get("address_family").(string)),
Mtu: aws.Int64(int64(d.Get("mtu").(int))),
},
}
if vgwOk && vgwIdRaw.(string) != "" {
Expand All @@ -128,6 +139,9 @@ func resourceAwsDxPrivateVirtualInterfaceCreate(d *schema.ResourceData, meta int
if v, ok := d.GetOk("amazon_address"); ok && v.(string) != "" {
req.NewPrivateVirtualInterface.AmazonAddress = aws.String(v.(string))
}
if v, ok := d.GetOk("mtu"); ok && v.(int) != 0 {
req.NewPrivateVirtualInterface.Mtu = aws.Int64(int64(v.(int)))
}

log.Printf("[DEBUG] Creating Direct Connect private virtual interface: %#v", req)
resp, err := conn.CreatePrivateVirtualInterface(req)
Expand Down Expand Up @@ -175,6 +189,8 @@ func resourceAwsDxPrivateVirtualInterfaceRead(d *schema.ResourceData, meta inter
d.Set("amazon_address", vif.AmazonAddress)
d.Set("vpn_gateway_id", vif.VirtualGatewayId)
d.Set("dx_gateway_id", vif.DirectConnectGatewayId)
d.Set("mtu", vif.Mtu)
d.Set("jumbo_frame_capable", vif.JumboFrameCapable)
if err := getTagsDX(conn, d, d.Get("arn").(string)); err != nil {
return err
}
Expand Down
3 changes: 3 additions & 0 deletions aws/resource_aws_dx_private_virtual_interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ resource "aws_dx_private_virtual_interface" "foo" {
vlan = 4094
address_family = "ipv4"
bgp_asn = %d
mtu = 9001
}
`, n, cid, n, bgpAsn)
}
Expand All @@ -151,6 +152,7 @@ resource "aws_dx_private_virtual_interface" "foo" {
vlan = 4094
address_family = "ipv4"
bgp_asn = %d
mtu = 9001

tags {
Environment = "test"
Expand All @@ -174,6 +176,7 @@ resource "aws_dx_private_virtual_interface" "foo" {
vlan = 4094
address_family = "ipv4"
bgp_asn = %d
mtu = 9001
}
`, n, amzAsn, cid, n, bgpAsn)
}
1 change: 1 addition & 0 deletions website/docs/r/dx_private_virtual_interface.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The following arguments are supported:
* `name` - (Required) The name for the virtual interface.
* `vlan` - (Required) The VLAN ID.
* `amazon_address` - (Optional) The IPv4 CIDR address to use to send traffic to Amazon. Required for IPv4 BGP peers.
* `mtu` - (Optional) The maximum transmission unit (MTU) is the size, in bytes, of the largest permissible packet that can be passed over the connection. The MTU of a virtual private interface can be either 1500 or 9001 (jumbo frames). Default is 1500. `jumbo_frame_capable` will be exported as `true` if jumbo frames have been enabled.
* `bgp_auth_key` - (Optional) The authentication key for BGP configuration.
* `customer_address` - (Optional) The IPv4 CIDR destination address to which Amazon should send traffic. Required for IPv4 BGP peers.
* `dx_gateway_id` - (Optional) The ID of the Direct Connect gateway to which to connect the virtual interface.
Expand Down