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

Add 'aws_dx_hosted_public_virtual_interface'/'aws_dx_hosted_public_virtual_interface_accepter' resources #3254

Merged
merged 7 commits into from
Jun 25, 2018

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Feb 4, 2018

@ewbankkit
Copy link
Contributor Author

Acceptance tests require an active Direct Connect connection which should be specified via the DX_CONNECTION_ID environment variable and an AWS account ID for the owner (accepter) of the virtual interface which should be specified via the DX_HOSTED_VIF_OWNER_ACCOUNT environment variable.

export DX_CONNECTION_ID=dxcon-xxxxxxxx
export DX_HOSTED_VIF_OWNER_ACCOUNT=xxxxxxxx
make testacc TEST=./aws/ TESTARGS='-run=TestAccAwsDxHostedPublicVirtualInterface_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAwsDxHostedPublicVirtualInterface_ -timeout 120m
=== RUN   TestAccAwsDxHostedPublicVirtualInterface_basic
--- PASS: TestAccAwsDxHostedPublicVirtualInterface_basic (39.34s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	48.976s

@ewbankkit
Copy link
Contributor Author

This PR and #3253 replace #876.

@bflad bflad added new-resource Introduces a new resource. service/directconnect Issues and PRs that pertain to the directconnect service. labels Feb 5, 2018
@ghost ghost added the size/XXL Managed by automation to categorize the size of a PR. label Feb 13, 2018
@ghost ghost added the size/XXL Managed by automation to categorize the size of a PR. label Jun 21, 2018
@ewbankkit
Copy link
Contributor Author

Rebased to remove conflicts.

@n3ph
Copy link
Contributor

n3ph commented Jun 22, 2018

Confirming acceptance tests in eu-central-1

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAwsDxHostedPublicVirtualInterface_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAwsDxHostedPublicVirtualInterface_ -timeout 120m
=== RUN   TestAccAwsDxHostedPublicVirtualInterface_basic
--- PASS: TestAccAwsDxHostedPublicVirtualInterface_basic (35.80s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	35.814s

@ewbankkit
Copy link
Contributor Author

Changes after code review on #3253.
Acceptance tests:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAwsDxHostedPublicVirtualInterface_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAwsDxHostedPublicVirtualInterface_ -timeout 120m
=== RUN   TestAccAwsDxHostedPublicVirtualInterface_basic
--- PASS: TestAccAwsDxHostedPublicVirtualInterface_basic (44.49s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	57.978s

@ewbankkit
Copy link
Contributor Author

Changes after additional code review on #3255.
Ran the example code in the documentation:

$ terraform apply
aws_dx_hosted_public_virtual_interface.creator: Creating...
  address_family:                   "" => "ipv4"
  amazon_address:                   "" => "175.45.176.2/30"
  arn:                              "" => "<computed>"
  bgp_asn:                          "" => "65352"
  bgp_auth_key:                     "" => "<computed>"
  connection_id:                    "" => "dxcon-ffffffff"
  customer_address:                 "" => "175.45.176.1/30"
  name:                             "" => "vif-foo"
  owner_account_id:                 "" => "000000000000"
  route_filter_prefixes.#:          "" => "2"
  route_filter_prefixes.1752038751: "" => "210.52.109.0/24"
  route_filter_prefixes.4290081960: "" => "175.45.176.0/22"
  vlan:                             "" => "4094"
aws_dx_hosted_public_virtual_interface.creator: Still creating... (10s elapsed)
aws_dx_hosted_public_virtual_interface.creator: Creation complete after 13s (ID: dxvif-ffffffff)
aws_dx_hosted_public_virtual_interface_accepter.accepter: Creating...
  arn:                  "" => "<computed>"
  tags.%:               "" => "1"
  tags.Side:            "" => "Accepter"
  virtual_interface_id: "" => "dxvif-ffffffff"
aws_dx_hosted_public_virtual_interface_accepter.accepter: Still creating... (10s elapsed)
aws_dx_hosted_public_virtual_interface_accepter.accepter: Creation complete after 12s (ID: dxvif-ffffffff)

Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.aws_caller_identity.accepter: Refreshing state...
aws_dx_hosted_public_virtual_interface.creator: Refreshing state... (ID: dxvif-ffffffff)
aws_dx_hosted_public_virtual_interface_accepter.accepter: Refreshing state... (ID: dxvif-ffffffff)

------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.
$ terraform destroy
data.aws_caller_identity.accepter: Refreshing state...
aws_dx_hosted_public_virtual_interface.creator: Refreshing state... (ID: dxvif-ffffffff)
aws_dx_hosted_public_virtual_interface_accepter.accepter: Refreshing state... (ID: dxvif-ffffffff)

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  - aws_dx_hosted_public_virtual_interface.creator

  - aws_dx_hosted_public_virtual_interface_accepter.accepter


Plan: 0 to add, 0 to change, 2 to destroy.

Do you really want to destroy?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

aws_dx_hosted_public_virtual_interface_accepter.accepter: Destroying... (ID: dxvif-ffffffff)
aws_dx_hosted_public_virtual_interface_accepter.accepter: Destruction complete after 0s
aws_dx_hosted_public_virtual_interface.creator: Destroying... (ID: dxvif-ffffffff)
aws_dx_hosted_public_virtual_interface.creator: Still destroying... (ID: dxvif-ffffffff, 10s elapsed)
aws_dx_hosted_public_virtual_interface.creator: Destruction complete after 11s

Destroy complete! Resources: 2 destroyed.

@n3ph
Copy link
Contributor

n3ph commented Jun 23, 2018

Acceptance tests in ´eu-central-1`

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAwsDxHostedPublicVirtualInterface_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAwsDxHostedPublicVirtualInterface_ -timeout 120m
=== RUN   TestAccAwsDxHostedPublicVirtualInterface_basic
--- PASS: TestAccAwsDxHostedPublicVirtualInterface_basic (48.61s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	48.620s

@n3ph
Copy link
Contributor

n3ph commented Jun 23, 2018

Here is a small test case

provider "aws" {
  max_retries = 3
  region      = "eu-central-1"
  profile     = "connect"
}

provider "aws" {
  max_retries = 3
  region      = "eu-central-1"
  profile     = "devops"
  alias       = "accepter"
}

variable "connection_id" {
  default = "dxcon-zzzzzzzz"
}

data "aws_caller_identity" "accepter" {
  provider = "aws.accepter"
}

resource "aws_dx_hosted_public_virtual_interface" "test" {
  connection_id    = "${var.connection_id}"
  owner_account_id = "${data.aws_caller_identity.accepter.account_id}"

  name           = "vif-test"
  vlan           = 1
  address_family = "ipv4"
  bgp_asn        = 65001

  customer_address = "175.45.176.1/30"
  amazon_address   = "175.45.176.2/30"

  route_filter_prefixes = [
    "210.52.109.0/24",
    "175.45.176.0/22",
  ]
}

resource "aws_dx_hosted_public_virtual_interface_accepter" "test" {
  virtual_interface_id = "${aws_dx_hosted_public_virtual_interface.test.id}"

  provider = "aws.accepter"
}
$ terraform apply
data.aws_caller_identity.accepter: Refreshing state...

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  + aws_dx_hosted_public_virtual_interface.test
      id:                               <computed>
      address_family:                   "ipv4"
      amazon_address:                   "175.45.176.2/30"
      arn:                              <computed>
      bgp_asn:                          "65001"
      bgp_auth_key:                     <computed>
      connection_id:                    "dxcon-zzzzzzzz"
      customer_address:                 "175.45.176.1/30"
      name:                             "vif-test"
      owner_account_id:                 "012345678901"
      route_filter_prefixes.#:          "2"
      route_filter_prefixes.1752038751: "210.52.109.0/24"
      route_filter_prefixes.4290081960: "175.45.176.0/22"
      vlan:                             "1"

  + aws_dx_hosted_public_virtual_interface_accepter.test
      id:                               <computed>
      arn:                              <computed>
      virtual_interface_id:             "${aws_dx_hosted_public_virtual_interface.test.id}"


Plan: 2 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_dx_hosted_public_virtual_interface.test: Creating...
  address_family:                   "" => "ipv4"
  amazon_address:                   "" => "175.45.176.2/30"
  arn:                              "" => "<computed>"
  bgp_asn:                          "" => "65001"
  bgp_auth_key:                     "" => "<computed>"
  connection_id:                    "" => "dxcon-zzzzzzzz"
  customer_address:                 "" => "175.45.176.1/30"
  name:                             "" => "vif-test"
  owner_account_id:                 "" => "012345678901"
  route_filter_prefixes.#:          "" => "2"
  route_filter_prefixes.1752038751: "" => "210.52.109.0/24"
  route_filter_prefixes.4290081960: "" => "175.45.176.0/22"
  vlan:                             "" => "1"
aws_dx_hosted_public_virtual_interface.test: Still creating... (10s elapsed)
aws_dx_hosted_public_virtual_interface.test: Creation complete after 11s (ID: dxvif-fgpr4aja)
aws_dx_hosted_public_virtual_interface_accepter.test: Creating...
  arn:                  "" => "<computed>"
  virtual_interface_id: "" => "dxvif-fgpr4aja"
aws_dx_hosted_public_virtual_interface_accepter.test: Still creating... (10s elapsed)
aws_dx_hosted_public_virtual_interface_accepter.test: Creation complete after 11s (ID: dxvif-fgpr4aja)

Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
$ terraform apply
data.aws_caller_identity.accepter: Refreshing state...
aws_dx_hosted_public_virtual_interface.test: Refreshing state... (ID: dxvif-fgpr4aja)
aws_dx_hosted_public_virtual_interface_accepter.test: Refreshing state... (ID: dxvif-fgpr4aja)

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
$ terraform destroy
data.aws_caller_identity.accepter: Refreshing state...
aws_dx_hosted_public_virtual_interface.test: Refreshing state... (ID: dxvif-fgpr4aja)
aws_dx_hosted_public_virtual_interface_accepter.test: Refreshing state... (ID: dxvif-fgpr4aja)

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  - aws_dx_hosted_public_virtual_interface.test

  - aws_dx_hosted_public_virtual_interface_accepter.test


Plan: 0 to add, 0 to change, 2 to destroy.

Do you really want to destroy?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes 

aws_dx_hosted_public_virtual_interface_accepter.test: Destroying... (ID: dxvif-fgpr4aja)
aws_dx_hosted_public_virtual_interface_accepter.test: Destruction complete after 0s
aws_dx_hosted_public_virtual_interface.test: Destroying... (ID: dxvif-fgpr4aja)
aws_dx_hosted_public_virtual_interface.test: Still destroying... (ID: dxvif-fgpr4aja, 10s elapsed)
aws_dx_hosted_public_virtual_interface.test: Destruction complete after 11s

Destroy complete! Resources: 2 destroyed.

@bflad bflad added this to the v1.25.0 milestone Jun 25, 2018
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Looks great @ewbankkit thanks for all your work here! 🚀

@bflad bflad merged commit 5af4581 into hashicorp:master Jun 25, 2018
bflad added a commit that referenced this pull request Jun 25, 2018
@ewbankkit ewbankkit deleted the issue-3250 branch June 25, 2018 14:01
@bflad
Copy link
Contributor

bflad commented Jun 27, 2018

This has been released in version 1.25.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 5, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-resource Introduces a new resource. service/directconnect Issues and PRs that pertain to the directconnect service. size/XXL Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Add aws_dx_hosted_public_virtual_interface resource
3 participants