Commit Graph

74 Commits

Author SHA1 Message Date
Mitchell Hashimoto d85df63526
providers/aws: aws_instance id-only 2016-04-22 09:37:41 -07:00
clint shryock 2830558bc9 check resource data for base64 encoded string 2016-04-13 10:44:26 -05:00
Doug Neal 1c662c2bc4 [#4794] Don't Base64-encode EC2 userdata if it is already Base64 encoded (#6140)
* Don't Base64-encode EC2 userdata if it is already Base64 encoded

The user data may be Base64 encoded already - for example, if it has been
generated by a template_cloudinit_config resource.

* Add encoded user_data to aws_instance acceptance test
2016-04-13 10:20:20 -05:00
clint shryock 02ba1bf2d4 provider/aws: More Acc test updates
Working on the green

- randomize some Autoscaling lifecycle hook test names
- use vpc_security_group_ids for this test
2016-03-10 14:33:54 -06:00
Paul Hinze 4af2c5f5dd core: fix diff mismatch when RequiresNew field and list both change
fixes #1752

Includes AccTest reproducing example from the issue as well as a bunch
of explanatory comments in the tests and impls.
2016-01-19 15:38:04 -06:00
Paul Hinze c8319d3b72 provider/aws: fix CheckDestroy on aws_instance tests 2015-12-22 08:49:50 -06:00
clint shryock 4a5847f9ea providers/aws: Vet aws 2015-12-01 10:00:35 -06:00
Clint Shryock efa26ed2a7 provider/aws: Fix issue with disabling source dest check on first run 2015-10-01 17:00:30 -05:00
Clint Shryock 0c2f189d08 provider/aws: Update to aws-sdk 0.9.0 rc1 2015-08-17 13:27:16 -05:00
Clint Shryock 579ccbefea provider/aws: Update source to comply with upstream breaking change 2015-07-28 15:29:46 -05:00
Mitchell Hashimoto 0b3d249727 provider/aws: ignore providers with Meta nil
We changed the way validation works for providers so that they aren't
always configured if they have computed attributes. The result is that
sometimes the Configure won't be called, hence Meta is nil
2015-06-30 10:24:53 -07:00
Paul Hinze 020dc03234 provider/aws: fix root_block_device for odd AMIs
Some AMIs have a RootDeviceName like "/dev/sda1" that does not appear as a
DeviceName in the BlockDeviceMapping list (which will instead have
    something like "/dev/sda")

While this seems like it breaks an invariant of AMIs, it ends up working
on the AWS side, and AMIs like this are common enough that we need to
special case it so Terraform does the right thing.

Our heuristic is: if the RootDeviceName does not appear in the
BlockDeviceMapping, assume that the DeviceName of the first
BlockDeviceMapping entry serves as the root device.

fixes #2224
2015-06-23 09:01:41 -05:00
Clint Shryock 9885ac8689 provider/aws: Fix issue with associating KeyPairs with Instances 2015-06-10 14:02:26 -05:00
Paul Hinze 66c51d44f6 aws/provider convert _normal tests to _basic
For consistency!
2015-06-07 18:04:38 -05:00
Clint Shryock fcd89828f9 provider/aws: Correctly default Instance source_dest_check to true 2015-06-03 15:54:01 -05: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
Paul Hinze e1ea427649 provider/aws: support ec2 termination protection
closes #1233
2015-05-15 15:20:58 -04:00
Clint Shryock f7b6b6b2b5 Strip 'sdk' suffix from methods; it's a remnant 2015-05-12 14:58:10 -05:00
Paul Hinze 010a39a58e provider/aws: remove placement_group from acctest
Depends on there being an existing placement group in the account called
"terraform-placement-group" - we'll need to circle back around to cover
this with AccTests after TF gets an `aws_placement_group` resource.
2015-05-06 10:13:24 -05:00
Clint Shryock 036d199dd6 provider/aws: Fix issue with updating VPC Security Group IDs for an Instance
Currently, we weren't correctly setting the ids, and are setting both
`security_groups` and `vpc_security_group_ids`. As a result, we really only use
the former.

We also don't actually update the latter in the `update` method.

This PR fixes both issues, correctly reading `security_groups` vs.
`vpc_security_group_ids` and allows users to update the latter without
destroying the Instance when in a VPC.
2015-04-29 10:03:57 -05:00
Mitchell Hashimoto 57af67b314 Merge pull request #1718 from ravenac95/encrypted-ebs-volume-fix
provider/aws: Fix connecting encrypted ebs volumes to aws_instances
2015-04-28 20:21:12 -07:00
Reuven V. Gonzales e8e42decc9 Added docs about m3.medium to tests 2015-04-28 15:19:31 -07:00
Reuven V. Gonzales 25ab54b4e3 Added tests to check for encrypted flag 2015-04-28 15:07:23 -07:00
Mitchell Hashimoto b755459ee3 Merge pull request #1358 from rzh/placement_group
provider/aws: support for AWS Placement Group
2015-04-22 08:20:43 +02:00
Matt Good 21b0a03d70 Support for multiple providers of the same type
Adds an "alias" field to the provider which allows creating multiple instances
of a provider under different names. This provides support for configurations
such as multiple AWS providers for different regions. In each resource, the
provider can be set with the "provider" field.

(thanks to Cisco Cloud for their support)
2015-04-20 14:14:34 -07:00
Clint Shryock ba43b7c963 mass search-replace of ec2SDKconn 2015-04-16 15:05:55 -05:00
Clint Shryock a5b2437dcf provider/aws: Convert Instance to use upstream library 2015-04-16 12:01:10 -05:00
Clint Shryock 3337503eda update test and documentation for vpc ids in instances 2015-04-15 12:17:21 -05:00
Paul Hinze 1118a86798 providers/aws: make acc test name match pattern 2015-04-09 12:33:20 -05:00
Paul Hinze 34c7bbcf4d providers/aws: reduce scope of block_device set hashcodes
Fixes #1409

Resource set hash calculation is a bit of a devil's bargain when it
comes to optional, computed attributes.

If you omit the optional, computed attribute from the hash function,
changing it in an existing config is not properly detected.

If you include the optional, computed attribute in the hash and do not
specify a value for it in the config, then you'll end up with a
perpetual, unresolvable diff.

We'll need to think about how to get the best of both worlds, here, but
for now I'm switching us to the latter and documenting the fact that
changing these attributes requires manual `terraform taint` to apply.
2015-04-09 08:53:09 -05:00
Rui Zhang 94bb3ed513 Support for AWS Placement Group
- add placement_group for aws instance
- update test and document
2015-04-01 23:33:16 -07:00
Paul Hinze a4e80b6313 providers/aws: derive instance root_block_device name
I was working on building a validation to check the user-provided
"device_name" for "root_block_device" on AWS Instances, when I realized
that if I can check it, I might as well just derive it automatically!

So that's what we do here - when you customize the details of the root
block device, device name is just comes from the selected AMI.
2015-03-23 11:58:45 -05:00
Paul Hinze 6c62e23829 providers/aws: fix bug w/ empty block dev mapping
fixes #1249
2015-03-19 13:14:31 -05:00
Paul Hinze f990c3b02b providers/aws: fix blockdevices acceptance test
hashcodes just needed updating from latest hash func tweaks
2015-03-19 11:40:48 -05:00
Paul Hinze 2b23c402ee providers/aws: rework instance block devices
Instance block devices are now managed by three distinct sub-resources:

 * `root_block_device` - introduced previously
 * `ebs_block_device` - all additional ebs-backed volumes
 * `ephemeral_block_device` - instance store / ephemeral devices

The AWS API support around BlockDeviceMapping is pretty confusing. It's
a single collection type that supports these three members each of which
has different fields and different behavior.

My biggest hiccup came from the fact that Instance Store volumes do not
show up in any response BlockDeviceMapping for any EC2 `Describe*` API
calls. They're only available from the instance meta-data service as
queried from inside the node.

This removes `block_device` altogether for a clean break from old
configs. New configs will need to sort their `block_device`
declarations into the three new types. The field has been marked
`Removed` to indicate this to users.

With the new block device format being introduced, we need to ensure
Terraform is able to properly read statefiles written in the old format.
So we use the new `helper/schema` facility of "state migrations" to
transform statefiles in the old format to something that the current
version of the schema can use.

Fixes #858
2015-03-19 09:03:41 -05:00
Paul Hinze ca6f6a1e14 providers/aws: fix TestAccAWSInstance_normal
The test just needed updated SHAs for user_data.
2015-03-18 08:57:41 -05:00
Clint dc4abb48fa Merge pull request #1195 from hashicorp/f-retire-goamz
provider/aws: Retire goamz
2015-03-16 08:42:40 -05:00
Clint Shryock 670d22e18f update acceptance test with the correct depends_on declarations 2015-03-13 14:58:05 -05:00
Clint Shryock 14a4ea65ea Merge branch 'master' into b-aws-instance-sec-groups
* master:
  provider/aws: Fix encoding bug with AWS Instance
  minor style cleanups
  Tags Schema
  Added Tagging
  Added vpc refactor in aws sdk go
  Removed additional variable for print, added for debugging
  Using hashicorp/aws-sdk-go
  Changed things around as suggested by @catsby
  Refactor with Acceptance Tests
  VPC Refactor
  First refactor
  Added Connection to config
2015-03-13 14:39:29 -05:00
Clint Shryock d5f23aec0a provider/aws: Fix encoding bug with AWS Instance 2015-03-13 10:54:00 -05:00
Clint Shryock 28fbd971fc Retire goamz 2015-03-13 09:42:50 -05:00
Clint Shryock 57556bba75 Replace tags files with tags_sdk, rename, and update 2015-03-12 16:43:08 -05:00
Clint Shryock 33fdc0c63f update the new test config 2015-03-12 15:01:24 -05:00
Clint Shryock 3a5918d013 Add acceptance test for Network / Instance security group fix 2015-03-12 14:26:10 -05:00
Clint Shryock 94d30aa70a provider/aws: Convert aws instance test to aws-sdk
convert AWS Instance and Test file to use aws-sdk-go
2015-03-06 14:53:05 -06:00
Suguru Namura 68efa3fc21 providers/aws: add iops to block devices 2015-03-03 15:57:08 +09:00
Paul Hinze 473b03ccae providers/aws: fix source_dest_check on instance creation
The `SourceDestCheck` attribute can only be changed via
`ModifyInstance`, so the AWS instance resource's `Create` function calls
out to `Update` before it returns to take care of applying
`source_dest_check` properly.

The `Update` function originally guarded against unnecessary API calls
with `GetOk`, which worked fine until #993 when we changed the `GetOk`
semantics to no longer distinguish between "configured and zero-value"
and "not configured".

I attempted in #1003 to fix this by switching to `HasChange` for the
guard, but this does not work in the `Create` case.

I played around with a few different ideas, none of which worked:

(a) Setting `Default: true` on `source_dest_check' has no effect

(b) Setting `Computed: true` on `source_dest_check' and adding a `d.Set`
    call in the `Read` function (which will initially set the value to `true`
    after instance creation). I really thought I could get this to work,
    but it results in the following:

```go
d.Get('source_dest_check')       // true
d.HasChange('source_dest_check') // false
d.GetChange('source_dest_check') // old: false, new: false
```

I couldn't figure out a way of coherently dealing with that result, so I
ended up throwing up my hands and giving up on the guard altogether.
We'll call `ModifyInstance` more than we have to, but this at least
yields expected behavior for both Creates and Updates.

Fixes #1020
2015-02-21 14:26:46 -06:00
Paul Hinze 434a9759a0 providers/aws: enhance root_block_device acceptance test
So that we have a test that will fail in case the flubbery of #1000
returns.
2015-02-18 17:28:28 -06:00
Paul Hinze 73d20b4c58 providers/aws: add root_block_device to aws_instance
AWS provides a single `BlockDeviceMapping` to manage three different
kinds of block devices:

 (a) The root volume
 (b) Ephemeral storage
 (c) Additional EBS volumes

Each of these types has slightly different semantics [1].

(a) The root volume is defined by the AMI; it can only be customized
with `volume_size`, `volume_type`, and `delete_on_termination`.

(b) Ephemeral storage is made available based on instance type [2]. It's
attached automatically if _no_ block device mappings are specified, and
must otherwise be defined with block device mapping entries that contain
only DeviceName set to a device like "/dev/sdX" and VirtualName set to
"ephemeralN".

(c) Additional EBS volumes are controlled by mappings that omit
`virtual_name` and can specify `volume_size`, `volume_type`,
`delete_on_termination`, `snapshot_id`, and `encryption`.

After deciding to ignore root block devices to fix #859, we had users
with configurations that were attempting to manage the root block device chime
in on #913.

Terraform does not have the primitives to be able to properly handle a
single collection of resources that is partially managed and partially
computed, so our strategy here is to break out logical sub-resources for
Terraform and hide the BlockDeviceMapping inside the provider
implementation.

Now (a) is supported by the `root_block_device` sub-resource, and (b)
and (c) are still both merged together under `block_device`, though I
have yet to see ephemeral block devices working properly.

Looking into possibly separating out `ephemeral_block_device` and
`ebs_block_device` sub-resources as well, which seem like the logical
next step. We'll wait until the next big release for this, though, since
it will break backcompat.

[1] http://bit.ly/ec2bdmap
[2] http://bit.ly/instancestorebytype

Fixes #913
Refs #858
2015-02-18 13:15:11 -06:00