Commit Graph

107 Commits

Author SHA1 Message Date
Paul Hinze 60a5d11fa8 provider/aws: remove default from associate_public_ip_address
I snuck this in with #2263 because thought it was simply a stylistic
clarity thing, but it actually generates a resource-replacement-forcing
diff for existing resources that don't have this set in the config.
Definitely don't want that. :P

/cc @catsby
2015-06-08 12:39:36 -05:00
Paul Hinze 112724fc39 provider/aws: spot_instance_request
This is an iteration on the great work done by @dalehamel in PRs #2095
and #2109.

The core team went back and forth on how to best model Spot Instance
Requests, requesting and then rejecting a separate-resource
implementation in #2109.

After more internal discussion, we landed once again on a separate
resource to model Spot Instance Requests. Out of respect for
@dalehamel's already-significant donated time, with this I'm attempting
to pick up the work to take this across the finish line.

Important architectural decisions represented here:

 * Spot Instance Requests are always of type "persistent", to properly
   match Terraform's declarative model.
 * The spot_instance_request resource exports several attributes that
   are expected to be constantly changing as the spot market changes:
   spot_bid_status, spot_request_state, and instance_id. Creating
   additional resource dependencies based on these attributes is not
   recommended, as Terraform diffs will be continually generated to keep
   up with the live changes.
 * When a Spot Instance Request is deleted/canceled, an attempt is made
   to terminate the last-known attached spot instance. Race conditions
   dictate that this attempt cannot guarantee that the associated spot
   instance is terminated immediately.

Implementation notes:

 * This version of aws_spot_instance_request borrows a lot of common
   code from aws_instance.
 * In order to facilitate borrowing, we introduce `awsInstanceOpts`, an
   internal representation of instance details that's meant to be shared
   between resources. The goal here would be to refactor ASG Launch
   Configurations to use the same struct.
 * The new aws_spot_instance_request acc. test is passing.
 * All aws_instance acc. tests remain passing.
2015-06-07 17:33:32 -05:00
Clint Shryock 2a0dc4e277 don't set this, it messes things up 2015-06-03 17:10:07 -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
Clint Shryock db8805dfa5 provider/aws: Fix issue with restoring from snapshot ID
Fixes #1862
2015-05-28 11:25:13 -05:00
Clint b2af84f466 Merge pull request #2026 from hashicorp/f-aws-instance-move-tags
providers/aws: Move up where we assign tags on Instance
2015-05-22 06:48:04 -05:00
Clint Shryock a2baf1d755 provider/aws: Retry RunInstance if IAM profile hasn't propagated 2015-05-21 14:58:34 -05:00
Clint Shryock 12e69084ef providers/aws: Move up where we assign tags on Instance 2015-05-20 15:33:01 -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
Mitchell Hashimoto e7c6cb22c5 provider/aws: bad AMI won't block LC refresh [GH-1901] 2015-05-13 20:28:36 -07:00
Clint Shryock f7b6b6b2b5 Strip 'sdk' suffix from methods; it's a remnant 2015-05-12 14:58:10 -05:00
Phil Frost 33183c078b Implement a hash function for string sets
Sets of strings are pretty common. Let's not duplicate the function
necessary to create a set of strings in so many places.
2015-05-05 12:47:18 -04: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 4ef6d468e9 Actually sends ebs encrypted flag 2015-04-28 10:54:30 -07:00
Mitchell Hashimoto ec38a65dda providers/aws: if no public IP, use private IP for SSH by default 2015-04-22 12:25:28 +02: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
Radek Simko 009514f0d3 Allow using deprecated security_groups in NI spec 2015-04-17 21:26:17 +01: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 97b98b1da6 Merge branch 'master' into f-aws-instance-vpc-sec-ids
* master: (511 commits)
  Update CHANGELOG.md
  core: avoid diff mismatch on NewRemoved fields during -/+
  Update CHANGELOG.md
  update CHANGELOG
  Fix minor error in index/count docs
  terraform: remove debug
  terraform: when pruning destroy, only match exact nodes, or exact counts
  up version for dev
  update CHANGELOG
  terraform: prune tainted destroys if no tainted in state [GH-1475]
  update CHANGELOG
  config/lang: support math on variables through implicits
  update CHANGELOG
  update cHANGELOG
  update cHANGELOG
  providers/aws: set id outside if/esle
  providers/aws: set ID after creation
  core: remove dead code from pre-deposed refactor
  website: update LC docs to note name is optional
  security_groups field expects a list of Security Group Group Names, not IDs
  ...
2015-04-15 12:12:17 -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 5e1de9d930 Merge pull request #1250 from hashicorp/b-block-devices
providers/aws: fix bug w/ empty block dev mapping
2015-03-19 13:21:08 -05:00
Paul Hinze 6c62e23829 providers/aws: fix bug w/ empty block dev mapping
fixes #1249
2015-03-19 13:14:31 -05:00
Clint Shryock c1ccbb5c7d provider/aws: Add VPC guards for Tenancy, SourceDestCheck 2015-03-19 10:07:46 -05:00
Paul Hinze 5fca25ae5e providers/aws: remove commented code
oopsie!
2015-03-19 09:19:10 -05:00
Paul Hinze 46b63074e0 Merge pull request #1045 from hashicorp/f-block-devices
providers/aws: rework instance block devices
2015-03-19 09:09:45 -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
Mitchell Hashimoto e84711b460 providers/aws: more classic-mode fixes for instance
/cc @catsby - Just a quick note to be careful about checking the nil of
a field before cehcking the value (see the subnetid check), to avoid
panics
2015-03-18 20:54:44 +01:00
Mitchell Hashimoto 50c49396f4 providers/aws: only set instance tenancy if its set
/cc @clint
2015-03-18 20:48:39 +01: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 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 749db242f4 Fix issue with Network interfaces and an instance-level security groups (#1188) 2015-03-12 11:08:53 -05:00
Clint Shryock 751140351b code cleanup on subnet check 2015-03-11 09:55:32 -05:00
Clint Shryock 9d6f05e529 restore IOPS positioning 2015-03-11 09:24:59 -05:00
Colin Hebert 675f8ea7b9 Print log in one line 2015-03-07 17:20:51 +11:00
Colin Hebert 2260045dc8 Improve backward compatibility for now 2015-03-07 17:16:59 +11:00
Colin Hebert 9e233a5cd7 Fix typo 2015-03-07 17:14:04 +11:00
Colin Hebert 18c3042c47 Differenciate security groups in VPC and in non VPC env 2015-03-07 17:04:53 +11: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 3c4d1791e5 providers/aws: fix aws_instance source_dest_check
Was relying on old behavior of GetOk and therefore never properly seeing
a change from true -> false.

This fixes the acceptance test failure of
`TestAccAWSInstance_sourceDestCheck`.
2015-02-18 17:46:50 -06:00