Skip to content

Commit

Permalink
Add route prefixes and update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
bodgit committed Mar 8, 2017
1 parent d3d9c87 commit 0b2a560
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/directconnect"
"github.com/hashicorp/terraform/helper/hashcode"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
)
Expand All @@ -20,6 +19,7 @@ func resourceAwsDirectConnectPublicVirtualInterfaceConfirm() *schema.Resource {

Importer: &schema.ResourceImporter{
State: func(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) {
d.Set("allow_down_state", false)
d.Set("virtual_interface_id", d.Id())
return []*schema.ResourceData{d}, nil
},
Expand Down Expand Up @@ -88,15 +88,20 @@ func resourceAwsDirectConnectPublicVirtualInterfaceConfirm() *schema.Resource {
ForceNew: true,
},

"auth_key": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},

"route_filter_prefixes": &schema.Schema{
Type: schema.TypeSet,
Optional: true,
Computed: true,
ForceNew: true,
Elem: &schema.Schema{Type: schema.TypeString},
Set: func(v interface{}) int {
return hashcode.String(v.(string))
},
Set: schema.HashString,
},
},
}
Expand Down Expand Up @@ -187,6 +192,14 @@ func resourceAwsDirectConnectPublicVirtualInterfaceConfirmRead(d *schema.Resourc
d.Set("amazon_address", virtualInterface.AmazonAddress)
d.Set("customer_address", virtualInterface.CustomerAddress)
d.Set("owner_account_id", virtualInterface.OwnerAccount)
d.Set("auth_key", virtualInterface.AuthKey)

set := &schema.Set{F: schema.HashString}
for _, val := range virtualInterface.RouteFilterPrefixes {
set.Add(*val.Cidr)
}
d.Set("route_filter_prefixes", set)

d.SetId(*virtualInterface.VirtualInterfaceId)

return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,41 @@ Provides a Direct Connect public Virtual Interface confirmation resource.

## Example Usage

Due to the interface possibly being created by an account out of your control
it's advisable to specify `prevent_destroy` in a [lifecycle][1] block.

```
resource "aws_directconnect_public_virtual_interface_confirm" "vif" {
virtual_interface_id = "dxvif-abc123"
lifecycle {
prevent_destroy = true
}
}
```

## Argument Reference

The following arguments are supported:

* `virtual_interface_id` - (Required) The ID of the public virtual interface.
* `allow_down_state` - (Optional) .
* `virtual_interface_id` - (Required) The ID of the virtual interface.
* `allow_down_state` - (Optional) Whether to allow the virtual interface to be BGP down.

## Attributes Reference

The following attributes are exported:

* `connection_id` - FIXME.
* `asn` - FIXME.
* `virtual_interface_name` - FIXME.
* `vlan` - FIXME.
* `amazon_address` - FIXME.
* `customer_address` - FIXME.
* `owner_account_id` - FIXME.
* `route_filter_prefixes` - FIXME.
* `connection_id` - The ID of the connection.
* `asn` - The autonomous system (AS) number for Border Gateway Protocol (BGP) configuration.
* `virtual_interface_name` - The name of the virtual interface assigned by the customer.
* `vlan` - The VLAN ID.
* `amazon_address` - IP address assigned to the Amazon interface.
* `customer_address` - IP address assigned to the customer interface.
* `owner_account_id` - The AWS account that will own the new virtual interface.
* `auth_key` - The authentication key for BGP configuration.
* `route_filter_prefixes` - A list of routes to be advertised to the AWS network in this region.

[1]: /docs/configuration/resources.html#lifecycle

## Import

Expand Down

0 comments on commit 0b2a560

Please sign in to comment.