Commit Graph

161 Commits

Author SHA1 Message Date
Paul Stack 546b424d7d provider/aws: Allow aws_instances to be resized rather than forcing a (#11998)
new instance

Fixes: #9157

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSInstance_changeInstanceType'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/02/16 15:13:21 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstance_changeInstanceType -timeout 120m
=== RUN   TestAccAWSInstance_changeInstanceType
--- PASS: TestAccAWSInstance_changeInstanceType (303.85s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	303.876s
```
2017-02-16 16:43:09 +02:00
Jake Champlin 3d22adbd5d
provider/aws: Fix root-block-device bug
Previously the `root_block_device` config map was a `schema.TypeSet` with an empty `Set` function, and a hard-limit of 1 on the attribute block.
This prevented a user from making any real changes inside the attribute block, thus leaving the user with a `Apply complete!` message, and nothing changed.

The schema API has since been updated, and we can now specify the `root_block_device` as a `schema.TypeList` with `MaxItems` set to `1`. This fixes the issue, and allows the user to update the `aws_instance`'s `root_block_device` attribute, and see changes actually propagate.
2017-02-01 16:25:07 -05:00
Jake Champlin 9cbd67dd0b
provider/aws: Add aws_instance data source
Adds the `aws_instance` data source, tests, and documentation.

```
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/01/18 11:49:09 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSInstanceDataSource -timeout 120m
=== RUN   TestAccAWSInstanceDataSource_basic
--- PASS: TestAccAWSInstanceDataSource_basic (106.24s)
=== RUN   TestAccAWSInstanceDataSource_AzUserData
--- PASS: TestAccAWSInstanceDataSource_AzUserData (108.52s)
=== RUN   TestAccAWSInstanceDataSource_gp2IopsDevice
--- PASS: TestAccAWSInstanceDataSource_gp2IopsDevice (80.71s)
=== RUN   TestAccAWSInstanceDataSource_blockDevices
--- PASS: TestAccAWSInstanceDataSource_blockDevices (94.07s)
=== RUN   TestAccAWSInstanceDataSource_rootInstanceStore
--- PASS: TestAccAWSInstanceDataSource_rootInstanceStore (95.17s)
=== RUN   TestAccAWSInstanceDataSource_privateIP
--- PASS: TestAccAWSInstanceDataSource_privateIP (241.75s)
=== RUN   TestAccAWSInstanceDataSource_keyPair
--- PASS: TestAccAWSInstanceDataSource_keyPair (208.77s)
=== RUN   TestAccAWSInstanceDataSource_VPC
--- PASS: TestAccAWSInstanceDataSource_VPC (109.89s)
=== RUN   TestAccAWSInstanceDataSource_SecurityGroups
--- PASS: TestAccAWSInstanceDataSource_SecurityGroups (118.66s)
=== RUN   TestAccAWSInstanceDataSource_VPCSecurityGroups
--- PASS: TestAccAWSInstanceDataSource_VPCSecurityGroups (136.79s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    1300.625s
```
2017-01-18 12:19:44 -05:00
Curtis Allen ad565974ac fixes double base64 encode
Add a utility that ensures a byte array is not doubly base64 encoded
Fixes #10786
2016-12-20 17:47:05 -07:00
Timon Wong 80afc6759b provider/aws: Add "no_device" support to ephemeral block devices (#10547)
Fixes #8455, #5390

This add a new `no_device` attribute to `ephemeral_block_device` block,
which allows users omit ephemeral devices from AMI's predefined block
device mappings, which is useful for EBS-only instance types.
2016-12-08 11:03:51 +01:00
Tom Wilkie 8029931086 Do not return a root device for instance store backed AMIs. (#9483)
* Do not return a root device for instance store backed AMIs.

* Add root EC2 instance store acceptance test.
2016-12-01 15:53:14 +02:00
clint shryock c014dac279 provider/aws: Make associate_public_ip_address computed 2016-10-24 11:24:54 -05:00
Tom Wilkie e79ebfc113 Infer aws_instance.associate_public_ip_address from the presence of a network interface association. 2016-10-19 16:16:04 +01:00
Modestas Vainius 7385fa9eac provider/aws: Support refresh of EC2 instance user_data.
Make sure to hash base64 decoded value since user_data might be given
either raw bytes or base64 value.

This helps https://github.com/hashicorp/terraform/issues/1887 somewhat
as now you can:

1) Update user_data in AWS console.
2) Respectively update user_data in terraform code.
3) Just refresh terraform state and it should not report any changes.
2016-10-12 15:19:25 -05:00
Paul Stack 338aab9169 provider/aws: Stop `aws_instance` `source_dest_check` triggering an API call on each (#8450)
terraform run

Fixes #3550

The simple fix here was to check if the Resource was new (to set the
value the first time) then check it has changed each time

I was able to see from the TF log the following:

```
Config

resource "aws_vpc" "foo" {
	cidr_block = "10.10.0.0/16"
}

resource "aws_subnet" "foo" {
	cidr_block = "10.10.1.0/24"
	vpc_id = "${aws_vpc.foo.id}"
}

resource "aws_instance" "foo" {
	ami = "ami-4fccb37f"
	instance_type = "m1.small"
	subnet_id = "${aws_subnet.foo.id}"
	source_dest_check = false
        disable_api_termination = true
}
```

No longer caused any Modifying source_dest_check entries in the LOG
2016-08-25 22:11:01 +01:00
Radek Simko ebf6e51b32 provider/aws: Retry association of IAM Role & instance profile (#7938) 2016-08-05 16:12:27 +10:00
Zachary Salzbank afb06f907f providers/aws: expose network interface id (#6751)
Expose the network interface ID that is created with a new instance.

This can be useful when associating an existing elastic IP to the
default interface on an instance that has multiple network interfaces.
2016-07-25 19:52:40 +01:00
Brian Menges 17b16f543e Ignore IOPS on non io1 AWS devices (#7783)
- Already ignoring IOPS on ebs attached non-io1 devices; extended to root_block_device
- Added warning captured from #4146 / [../blob/master/builtin/providers/aws/resource_aws_ebs_volume.go#L104](resource_aws_ebs_volume.go#L104)
- Added test when setting IOPS to 330 (11GiB * 30 = 330) on GP2 root device results in AWS reported 100 IOPS (successfully ignored input)
2016-07-25 12:32:24 +01:00
David Tolnay 2943a1c978 Retry creation of IAM role depending on new IAM user (#7324) 2016-07-07 15:24:17 -05:00
djuke c1eee521f3 reading the aws instance it was assumed that eth0 was the first in the list of network interfaces (#6761) 2016-05-29 23:01:58 +01:00
Mitchell Hashimoto 884980da1a
providers/aws: instance, nat, internet gateway 2016-05-16 10:03:57 -07:00
Mitchell Hashimoto d85df63526
providers/aws: aws_instance id-only 2016-04-22 09:37:41 -07: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
Paul Hinze e9c4d4f6d5 Revert "provider/aws: Support additional changes to security groups of instance without forcing new" 2016-03-10 14:51:30 -06:00
innossh 564dd360a2 provider/aws: Support additional changes to security groups of instance without forcing new 2016-02-21 14:24:33 +09:00
Trevor Pounds 0cd0ff0f8e Use built-in schema.HashString. 2016-02-07 16:29:34 -08:00
Ian Duffy 47ac10d66b Change resource.StateChangeConf to use an array for target states
Signed-off-by: Ian Duffy <ian@ianduffy.ie>
2016-01-21 01:20:41 +00:00
Clint 79c32ddbe9 Merge pull request #4627 from ColinHebert/patch-1
provider/aws: EBS optimised to force new resource
2016-01-14 14:57:13 -06:00
Clint c9231a73ec Merge pull request #4240 from hashicorp/b-aws-catch-sg-name-id-error
provider/aws: Trap Instance error from mismatched SG IDs and Names
2016-01-13 11:57:58 -06:00
Clint 4f8e9713cf Merge pull request #3261 from fatih/show-instance-state
aws: store and read instance state
2016-01-12 11:06:30 -06:00
Colin Hebert 2948d3678d provider/aws: EBS optimised to force new resource
EBS optimised can't be changed without re-creating the instance. Apply forcenew.
2016-01-11 08:16:49 +01:00
Clint e273fe6cfc Merge pull request #3663 from semarj/master
get profile name even if profile path exists
2015-12-18 10:55:23 -06:00
clint shryock 5c60f7f2c1 provider/aws: Trap Instance error from mismatched SG IDs and Names 2015-12-09 15:59:36 -06:00
clint shryock 9fc6c27de1 provider/aws: Check for empty instances in AWS Instance RunInstance response
Fixes #4206
2015-12-08 14:37:54 -06:00
Joshua Semar 31767accac get profile name even if profile path exists 2015-10-27 21:30:44 -05:00
Panagiotis Moustafellos e4845f75cc removed extra parentheses 2015-10-08 15:48:04 +03:00
Clint Shryock efa26ed2a7 provider/aws: Fix issue with disabling source dest check on first run 2015-10-01 17:00:30 -05:00
Fatih Arslan 545b8a3cd0 aws: store and read instance state
This allows us to store the instance state into the state file. This
means we can now easily see the instance state with `terraform show`.
2015-09-17 13:26:38 +03:00
Paul Hinze 96317a6a38 Merge pull request #3152 from dwradcliffe/read_source_dest_check_state
provider/aws: read instance source_dest_check and save to state
2015-09-16 10:29:37 -05:00
Paul Hinze dcaf0f8b87 provider/aws: correct && -> || mistake
Thanks for the sanity check, @aparrentlymart and @dwradcliffe :)
2015-09-06 12:01:57 -05:00
Paul Hinze 1dfad739bb provider/aws: tweak iam_instance_profile logic
- always `d.Set` to either the profile name or the empty string
 - add some conservative pointer checking to the helper method

/cc @dwradcliffe
2015-09-04 19:20:58 -05:00
David Radcliffe 0b88177cf0 read iam_instance_profile and save to state 2015-09-03 15:43:41 -04:00
David Radcliffe 987ec967ea read source_dest_check and save to state 2015-09-02 14:04:45 -04:00
Clint Shryock fde2a400f7 Merge branch 'master' into f-aws-pr-2779
* master: (84 commits)
  provider/aws: Update to aws-sdk 0.9.0 rc1
  use name instead of id  - launch configs use the name and not ID
  Fix typo on heroku_cert example
  provider/aws: add value into ELB name validation message
  tests: fix missed test update from last merge
  update prevent_destroy error message
  Update CHANGELOG.md
  Update CHANGELOG.md
  providers/aws: Update Launch Config. docs to detail naming and lifecycle recommendation
  release: cleanup after v0.6.3
  v0.6.3
  Update CHANGELOG.md
  core: fix deadlock when dependable node replaced with non-dependable one
  tests: extract deadlock checking test helper
  core: log every 5s while waiting for dependencies
  Fixed indentation in a code sample
  state/remote/s3: match with upstream changes
  provider/aws: match with upstream changes
  google: Add example of two-tier app
  Updating Launch Config Docs for Name attribute
  ...
2015-08-18 14:40:01 -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 8d5fe93152 conditionally set InstanceInitiatedShutdownBehavior 2015-08-04 06:09:47 -05:00
Clint Shryock 30572212f2 Merge branch 'master' into pr-2779
* master: (86 commits)
  providers/google: Fix reading account_file path
  providers/google: Fix error appending
  providers/google: Return if we could parse JSON
  providers/google: Change account_file to JSON
  providers/google: Default account_file* to empty
  providers/google: Add account_file/account_file_contents ConflictsWith
  providers/google: Document account_file_contents
  providers/google: Use account_file_contents if provided
  providers/google: Add account_file_contents to provider
  Update CHANGELOG.md
  Update CHANGELOG.md
  use d.Id()
  Update CHANGELOG.md
  Update CHANGELOG.md
  scripts: change website_push to push from HEAD
  update analytics
  core: fix crash on provider warning
  provider/aws: Update source to comply with upstream breaking change
  Update CHANGELOG.
  provider/aws: Fix issue with IAM Server Certificates and Chains
  ...
2015-07-29 15:54:56 -05:00
Clint Shryock 579ccbefea provider/aws: Update source to comply with upstream breaking change 2015-07-28 15:29:46 -05:00
Clint Shryock 99f9b93b57 provider/aws: Error when unable to find a Root Block Device name
Fixes #2633
2015-07-27 10:59:37 -05:00
Clint Shryock db5d0301d8 provider/aws: Fix issue with toggling monitoring in AWS Instances 2015-07-20 12:32:58 -05:00
Marc Tamsky 521451db4d provider/aws/aws_instance: add new argument `instance_initiated_shutdown_behavior`,
accepts string values of 'stop' or 'terminate'.

Signed-off-by: Marc Tamsky <tamsky@users.noreply.github.com>
2015-07-18 09:45:34 -07:00
Mitchell Hashimoto f6b9e7c1a6 providers/aws: set AMI on read for instance [GH-1571] 2015-06-26 17:12:20 -07:00
Mitchell Hashimoto 25fa84974b update CHANGELOG 2015-06-25 09:07:11 -07:00
Joshua Garnett d23f534d26 Adding support for detailed monitoring of instances 2015-06-25 10:58:28 -04:00
Paul Hinze 95235ba2cc Merge pull request #2374 from hashicorp/b-aws-detect-instance-type-drift
provider/aws: detect instance_type drift on aws_instance
2015-06-23 15:01:20 -05:00