Commit Graph

51 Commits

Author SHA1 Message Date
stack72 5479e178b9
provider/aws: Add some tests for the Import for aws_eip
The Read func of the EIP has changed to set the `vpc` boolean value on
the response object having an Address. This is required as an EIP that
was specified, without a domain and then imported, would cause a
perpetual plan.

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSEIP_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/09/23 09:28:32 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSEIP_ -timeout
120m
=== RUN   TestAccAWSEIP_importEc2Classic
--- PASS: TestAccAWSEIP_importEc2Classic (116.16s)
=== RUN   TestAccAWSEIP_importVpc
--- PASS: TestAccAWSEIP_importVpc (61.89s)
=== RUN   TestAccAWSEIP_basic
--- PASS: TestAccAWSEIP_basic (18.86s)
=== RUN   TestAccAWSEIP_instance
--- PASS: TestAccAWSEIP_instance (185.95s)
=== RUN   TestAccAWSEIP_network_interface
--- PASS: TestAccAWSEIP_network_interface (63.20s)
=== RUN   TestAccAWSEIP_twoEIPsOneNetworkInterface
--- PASS: TestAccAWSEIP_twoEIPsOneNetworkInterface (65.64s)
=== RUN   TestAccAWSEIP_associated_user_private_ip
--- PASS: TestAccAWSEIP_associated_user_private_ip (201.34s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    713.072s
```
2016-10-07 16:21:11 +01:00
Clint b7ad602993 provider/aws: Fix importing of EIP by IP address (#8970)
* provider/aws: Fix importing of EIP by IP address

EIPs are meant to be imported by their allocation id, however, importing
by their EIP *appears* to work because this API actually accepts IP
lookup, despite the documentation asking for the allocation id.

This PR does:

- update docs on how to import EIPs
- fix case if user imported by IP, to switch to using the alloc id for
the resource id

I chose not to document that looking up by IP is a method of import,
because the AWS  API docs do not explicitly say that looking up by IP is
OK, so I'd rather people not do it if it's not documented to stay that
way.

Alternatively, we could parse the resource ID and reject it (remove from
state with error/warning) if it doesn't match the `eipalloc-*` format,
but I thought this was a bit better UX.

* fix issue with swapping IDs on EC2 Classic

* update docs

* update comment
2016-09-22 21:53:21 -05:00
Clint 24bcac42be provider/aws: Retry EIP association (#7186) 2016-06-16 10:03:16 -05:00
Mitchell Hashimoto 420e13d2f2
providers/aws: eip uses passthrough importstate 2016-05-16 10:03:57 -07:00
Mitchell Hashimoto eb9cb46256
providers/aws: enable aws_eip importing 2016-05-11 13:02:34 -07:00
Clint 99e0aec769 provider/aws: Fix issue changing EIP Association (#6521)
provider/aws: Update EIP to use new associate_with_private_ip instead of private_ip
2016-05-06 15:38:39 -05:00
Mitchell Hashimoto c1509b0220
providers/aws: eip id-only 2016-04-21 22:17:14 -07:00
Paul Hinze 8380a7b03e provider/aws: Allow multiple EIPs to associate to single ENI
When calling AssociateAddress, the PrivateIpAddress parameter must be
used to select which private IP the EIP should associate with, otherwise
the EIP always associates with the _first_ private IP.

Without this parameter, multiple EIPs couldn't be assigned to a single
ENI. Includes covering test and docs update.

Fixes #2997
2016-04-07 13:26:15 -05:00
Paul Hinze 108ccf0007 builtin: Refactor resource.Retry to clarify return
Change the `RetryFunc` from a plain `error` return type to a
specialized `RetryError` which must decide whether it is
retryable or not.

Add `RetryableError` / `NonRetryableError` factory functions that
callers are meant to use to build up these errors.

This makes it eminently clear whether or not a given error is
retryable from inside the client code.

Goal here is to _not_ change any behavior, simply reflect the
existing behavior with the new, clearer, API.
2016-03-09 17:37:56 -06:00
Harry Macey 4f5df717b4 Fixes #4351
Adding empty string defaults for network interface and instance when reading `aws_eip` resource.
2015-12-16 17:38:05 -05:00
Clint Shryock 810d088279 Fix whitespace formatting with go fmt 2015-10-12 15:50:04 -05:00
Clint 4962ef159b Merge pull request #3036 from hashicorp/b-aws-eip-computed-instance
provider/aws: Allow Instance to be computed in EIPs
2015-10-08 09:38:26 -05:00
Clint Shryock c68d9c4ae0 provider/aws: Allow Instance to be computed in EIPs 2015-10-08 09:14:04 -05:00
Panagiotis Moustafellos e4845f75cc removed extra parentheses 2015-10-08 15:48:04 +03:00
Clint Shryock 0c2f189d08 provider/aws: Update to aws-sdk 0.9.0 rc1 2015-08-17 13:27:16 -05:00
Mitchell Hashimoto cc2a5ab18f provider/aws: ignore association not exist on EIP destroy [GH-2295] 2015-06-28 22:30:43 -07:00
Paul Hinze b71fa3d0ae provider/aws: handle upstream aws-sdk-go repo move
`awslabs/aws-sdk-go => aws/aws-sdk-go`

Congrats to upstream on the promotion. :)
2015-06-03 13:36:57 -05:00
Paul Hinze 31258e06c6 provider/aws: fix breakages from awserr refactor
This landed in aws-sdk-go yesterday, breaking the AWS provider in many places:

3c259c9586

Here, with much sedding, grepping, and manual massaging, we attempt to
catch Terraform up to the new `awserr.Error` interface world.
2015-05-20 06:21:23 -05:00
Mitchell Hashimoto 4db68cee89 providers/aws: eip network interface is computed 2015-05-06 10:04:38 -07:00
Mitchell Hashimoto 1c2d5fbd0a Merge branch 'f-aws-associate-eip-to-eni' of https://github.com/jstremick/terraform into jstremick-f-aws-associate-eip-to-eni 2015-05-05 13:24:50 -07:00
Radek Simko 795d53e706 [bugfix] Don't save instance ID if association fails
- typically happens when no internet GW is available in VPC
2015-05-01 23:55:08 +01:00
James Stremick e586d05a7d Remove some unecessary debug output I added 2015-04-29 10:21:28 -04:00
James Stremick 244639cf3d Remove some domain checking duplication 2015-04-29 10:21:28 -04:00
James Stremick b29e9d3b6f Allow assocation of EIP to ENI 2015-04-29 10:21:08 -04:00
Paul Hinze 120cfdce59 provider/aws: fix EIPs on new upstream sdk
As we've seen elsewhere, the SDK now wants nils instead of empty arrays
for collections

fixes #1696

thanks @jstremick for pointing me in the right direction
2015-04-27 19:55:26 -05:00
Mitchell Hashimoto dda4ae6d12 Merge pull request #1555 from fatih/fix-eip-panic
providers/aws: check allocationId only if it's vpc, fixes #1345
2015-04-19 18:10:31 -07:00
Clint Shryock ba43b7c963 mass search-replace of ec2SDKconn 2015-04-16 15:05:55 -05:00
Fatih Arslan 86810789c2 providers/aws: check allocationId only if it's vpc, fixes #1345
EIP with VPC only returns an allocationID. However, for standard we need
to lookup for PublicIP. When we use an example for standard EC2 instance
(here `t1.micro`):

```
resource "aws_instance" "example" {
    ami = "ami-25773a24"
    instance_type = "t1.micro"
}

resource "aws_eip" "ip" {
    instance = "${aws_instance.example.id}"
}

```

then in this case, allocationID will be nil, but publicIP will be non
nil (which is used later for association the IP).  So check for
allocationId only if it's of domain `VPC`.
2015-04-16 16:08:52 +03:00
Clint Shryock a15547b955 provider/aws: Convert EIP to use upstream aws-sdk-go 2015-04-07 10:37:17 -05:00
Clint Shryock 28fbd971fc Retire goamz 2015-03-13 09:42:50 -05:00
Clint Shryock 612a570a6d provider/aws: Convert AWS EIP to use aws-sdk-go 2015-03-03 11:45:27 -06:00
Radek Simko e149a97658 Make composite literals to use keyed fields
This will prevent following error:
 - * composite literal uses unkeyed fields
2015-02-18 18:26:59 +00:00
Sander van Harmelen eccd5ad308 Refactored about 90%
Still need to update 2 resources and check the acceptance tests, but
overall we’re nearly there 😃
2014-11-21 17:58:34 +01:00
Mitchell Hashimoto b25a536299 providers/aws: disassociate EIP before destroying 2014-10-18 15:32:33 -07:00
Mitchell Hashimoto 62e2743dcc providers/aws: retry delete of eip [GH-276] 2014-09-09 14:18:53 -07:00
Mitchell Hashimoto 57f287c06d providers/aws: check for non-exist on refresh 2014-09-09 14:15:33 -07:00
Mitchell Hashimoto a5b85dd788 providers/aws: check if instance is set on eip 2014-09-09 14:15:08 -07:00
Mitchell Hashimoto ab5e07a1f9 providers/aws: use GetOk to check for value [GH-258] 2014-09-08 20:24:43 -07:00
Mitchell Hashimoto 56cf1e6faa Fix go vet complaints 2014-08-24 21:50:35 -07:00
Mitchell Hashimoto d25747ba5c providers/aws: cleaner detection of VPC [GH-122] 2014-08-19 17:22:25 -07:00
Mitchell Hashimoto c4d261ac61 providers/aws: resource_aws_eip is in new framework 2014-08-19 16:56:23 -07:00
Alex Gaynor 46154ca1d3 Fixed a ton of typos in docs and comments 2014-08-07 00:19:56 -07:00
Armon Dadgar ebd50ab6ff provider/aws: Fixing EIP in EC2-VPC 2014-07-28 12:05:00 -04:00
Mitchell Hashimoto b1fc87fe59 providers/aws/aws_eip: support update (reassociation)
/cc @pearkes - woot
2014-07-26 15:53:26 -07:00
Jack Pearkes a87f2a7987 providers/aws: elb, eip config validations 2014-07-15 12:18:36 -04:00
Jack Pearkes 1bcdba6f84 providers/aws: tests for eip 2014-07-14 18:30:31 -04:00
Jack Pearkes 0319e89281 providers/aws: remove instance_id manual storage 2014-07-07 18:08:42 -04:00
Jack Pearkes fac9c6bf10 providers/aws: eip use retrieval helper 2014-07-07 17:42:20 -04:00
Jack Pearkes e83e0f72b2 providers/aws: eip retrieve func, elb fix state saves after create 2014-07-07 17:38:35 -04:00
Jack Pearkes 4f2388f787 providers/aws: eip destroy and drefresh 2014-07-07 15:37:38 -04:00