From 0b2a560740a41ad387fcad766a1620d23052d80a Mon Sep 17 00:00:00 2001 From: Matt Dainty Date: Wed, 8 Mar 2017 16:16:18 +0000 Subject: [PATCH] Add route prefixes and update docs --- ...onnect_public_virtual_interface_confirm.go | 21 ++++++++++--- ...ic_virtual_interface_confirm.html.markdown | 30 ++++++++++++------- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/builtin/providers/aws/resource_aws_directconnect_public_virtual_interface_confirm.go b/builtin/providers/aws/resource_aws_directconnect_public_virtual_interface_confirm.go index 71265bed3c61..d2d8f2202e66 100644 --- a/builtin/providers/aws/resource_aws_directconnect_public_virtual_interface_confirm.go +++ b/builtin/providers/aws/resource_aws_directconnect_public_virtual_interface_confirm.go @@ -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" ) @@ -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 }, @@ -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, }, }, } @@ -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 diff --git a/website/source/docs/providers/aws/r/directconnect_public_virtual_interface_confirm.html.markdown b/website/source/docs/providers/aws/r/directconnect_public_virtual_interface_confirm.html.markdown index d5396714845e..c15a80eb555d 100644 --- a/website/source/docs/providers/aws/r/directconnect_public_virtual_interface_confirm.html.markdown +++ b/website/source/docs/providers/aws/r/directconnect_public_virtual_interface_confirm.html.markdown @@ -12,9 +12,16 @@ 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 + } } ``` @@ -22,21 +29,24 @@ resource "aws_directconnect_public_virtual_interface_confirm" "vif" { 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