Commit Graph

12439 Commits

Author SHA1 Message Date
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
Mitchell Hashimoto 2f8baa4580
command/push: fix tests to be vcs=false GH-8478 2016-08-25 14:09:34 -07:00
James Bardin f326dad2ba Merge pull request #8452 from hashicorp/jbardin/locked-copy
Add locks to state structs for copying
2016-08-25 17:06:20 -04:00
Clint fc67b63d63 Update CHANGELOG.md 2016-08-25 16:04:21 -05:00
Clint 49ecfe8921 provider/aws: Add aws_default_route_table resource (#8323)
* provider/aws: Add docs for Default Route Table

* add new default_route_table_id attribute, test to VPC

* stub

* add warning to docs

* rough implementation

* first test

* update test, add swap test

* fix typo
2016-08-25 16:02:44 -05:00
James Bardin 4559eec8be Remove the proposed LockedCopy function
We didn't add the LockedCopy function in copystructure, in favor of
using the Config struct directly.
2016-08-25 16:55:28 -04:00
James Bardin c047bc63d8 update github.com/mitchellh/copystructure
This add the locked copy feature, and also fixed #8100
2016-08-25 16:53:41 -04:00
David Tolnay b09e042bf5 provider/aws: Propagate errors from DetachVolume 2016-08-25 14:46:46 -04:00
James Bardin 0e6e206465 Add an InstanceState.Set method to set all fields
We con no longer copy an InstanceState via a simple
dereference+assignment because of the mutex which can't be copied. This
adds a set method to properly set all field from another InstanceState,
and take the appropriate locks while doing so.
2016-08-25 14:41:51 -04:00
James Bardin 2a47b32374 fix State.Add chart so it renders in godoc 2016-08-25 14:41:51 -04:00
James Bardin 7a579c271d Remove GoString methods from state
These method set the GoString format behavior, but they only output the
default GoString format. Remove them to prevent copying mutex values.
2016-08-25 14:41:39 -04:00
Paul Stack ab5b463923 Update CHANGELOG.md 2016-08-25 18:13:04 +01:00
stack72 b02213a31a
Merge branch 'optimisticanshul-aws_ecs_container_definition_memory_reservation' 2016-08-25 18:11:13 +01:00
stack72 0087068a0e
provider/aws: `aws_ecs_container_definition` datasource parameter
changes to memory_reservation
2016-08-25 18:10:08 +01:00
stack72 7a852dacf2
Merge branch 'aws_ecs_container_definition_memory_reservation' of https://github.com/optimisticanshul/terraform into optimisticanshul-aws_ecs_container_definition_memory_reservation 2016-08-25 17:51:38 +01:00
Radek Simko 1494f493a2 aws/docs: Add missing ssm link to the sidebar (#8476) 2016-08-25 17:46:52 +01:00
stack72 5861802d08 release: clean up after v0.7.2 2016-08-25 15:11:50 +00:00
stack72 117006c82c Merge branch 'master' of github.com:hashicorp/terraform 2016-08-25 15:05:24 +00:00
Jake Champlin c2a0d29955 Merge pull request #8451 from hashicorp/f-specify-ldflags-from-env-vars
Allow specifying ldflags via env vars
2016-08-25 10:34:47 -04:00
stack72 0985f39e99
v0.7.2 2016-08-25 14:29:18 +00:00
Paul Stack 7949a30a07 provider/aws: Randomize the key_pair used in the (#8472)
`aws_spot_fleet_request` acceptance tests
2016-08-25 14:40:57 +01:00
Christoph Blecker 7e0ab86b9e Fix acceptance test image reversion (#8349) 2016-08-25 14:39:03 +01:00
Paul Stack 0adc1fc4b2 provider/aws: Allow `aws_rds_instance` to upgrade the major version (#8471)
Fixes #8468

If a user wished to bump the `engine_version` of an RDS instance,
Terraform was not sending `allow_major_version_upgrade` to the API
*unless* that value also changed at the same time. This caused the
following error from RDS API:

```
* aws_db_instance.bar: Error modifying DB Instance
* tf-20160825101420910562798obb: InvalidParameterCombination: The
* AllowMajorVersionUpgrade flag must be present when upgrading to a new
* major version.
    status code: 400, request id: 20e36364-6ab0-11e6-b794-51f12f4135f1
```

This change will always send the `allow_major_version_upgrade` flag to
the API when the `engine_version` changes.

This still relies on the user setting the correct value i.e. if they are
upgrading from postgres 0.4.7 -> 9.5.2 then the config will need to set
the `allow_major_version_upgrade` flag to be `true`
2016-08-25 13:54:40 +01:00
Paul Stack 5f567e7cd9 Update CHANGELOG.md 2016-08-25 11:04:18 +01:00
Richard Clamp 9be1ff5d53 Fix segmentation fault in "aws_api_gateway_base_path_mapping" resource (#8466)
It is possible for the `mapping.BasePath`, `mapping.RestApiId`, and
`mapping.Stage` to be nil when they have not been set for the
mapping.[1]  When this occurs a nil pointer is dereferenced and terraform
segmentation faults.

Here we remove the blind derefrences and trust in the behaviour of
(*ResourceData).Set() to handle the nil pointer safely.

[1] https://github.com/hashicorp/terraform/blob/master/vendor/github.com/aws/aws-sdk-go/service/apigateway/api.go#L4892-L4904
2016-08-25 11:03:42 +01:00
Paul Stack c157a67085 Update CHANGELOG.md 2016-08-25 09:47:58 +01:00
Paul Stack 64510d9cfb provider/aws: Adding `aws_ssm_document` resource (#8460)
* provider/aws: add `aws_ssm_document` resource

* provider/aws: Changes to `aws_ssm_document` post code review

The changes are things like using d.Id rather than d.Get("name").(string)

and errwrap.Wrapf rather than fmt.Errorf
2016-08-25 09:47:24 +01:00
Mitchell Hashimoto 73f7c04159
terraform: clear docs for devs 2016-08-24 18:44:54 -07:00
Mitchell Hashimoto 3376611ad0
terraform: Validate validates single module states 2016-08-24 18:42:13 -07:00
Mitchell Hashimoto c65bbc4f0c
terraform: minor edits to reading state to prep for validation 2016-08-24 18:20:47 -07:00
Mitchell Hashimoto 6b67227331 Merge pull request #8462 from hashicorp/b-getter
Update go-getter
2016-08-24 16:55:10 -07:00
Mitchell Hashimoto 997f2b332b
vendor: update go-getter 2016-08-24 16:48:59 -07:00
Mitchell Hashimoto f1f20a3a58 Update CHANGELOG.md 2016-08-24 16:43:53 -07:00
Paul Stack cf93c43969 Update CHANGELOG.md 2016-08-24 21:31:11 +01:00
Paul Stack 3901827b40 provider/aws: Validate `aws_iam_policy_attachment` Name parameter to stop being empty (#8441)
* provider/aws: Validate `aws_iam_policy_attachment` Name parameter to
stop being empty

Fixes #8368

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSPolicyAttachment_'
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/08/24 11:46:01 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSPolicyAttachment_ -timeout 120m
=== RUN   TestAccAWSPolicyAttachment_basic
--- PASS: TestAccAWSPolicyAttachment_basic (44.67s)
=== RUN   TestAccAWSPolicyAttachment_paginatedEntities
--- PASS: TestAccAWSPolicyAttachment_paginatedEntities (161.68s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    206.379s
```

* Update resource_aws_iam_policy_attachment.go
2016-08-24 21:28:41 +01:00
Mitchell Hashimoto 799a7f6c9b Update CHANGELOG.md 2016-08-24 13:18:57 -07:00
Mitchell Hashimoto 6a507fd5d0 Merge pull request #8456 from hashicorp/b-upload-module
command/push: -upload=modules=false works
2016-08-24 13:18:19 -07:00
Paul Stack 886995269a Update CHANGELOG.md 2016-08-24 20:58:04 +01:00
stack72 7cfe85ee70
Merge branch 'master' of github.com:hashicorp/terraform 2016-08-24 20:53:57 +01:00
stack72 7389dca606
Merge branch 'mbrannigan-feature/add_password_validation_redshift_cluster' 2016-08-24 20:52:01 +01:00
stack72 01fca172cb
provider/aws: Removing the merge conflict from the redshift_cluster resource 2016-08-24 20:50:06 +01:00
Jearvon Dharrie 14deee1fd4 Fix typo (#8459)
Change `you project` to `your project`
2016-08-24 20:44:24 +01:00
Clint d60cb11dd1 Update CHANGELOG.md 2016-08-24 13:25:27 -05:00
Clint 341c7bf766 provider/aws: Update VPC Peering connect accept/request attributes (supersedes #8338) (#8432)
* Fix crash when reading VPC Peering Connection options.

This resolves the issue introduced in #8310.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>

* Do not de-reference values when using Set().

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>

* provider/aws: Update VPC Peering connect accept/request attributes

* change from type list to type set

* provider/aws: Update VPC Peering accept/requst options, tests

* errwrap some things
2016-08-24 13:24:42 -05:00
Mitchell Hashimoto 9a8209cfbd
command/push: create the proper parent directory entries in tar 2016-08-24 10:39:50 -07:00
Joe Topjian 48685fefe1 Update CHANGELOG.md 2016-08-24 09:38:16 -06:00
Joe Topjian 49bda267c9 Merge pull request #8172 from jtopjian/openstack-volumeattach-fix
provider/openstack: Volume Attachment and Detachment Fixes
2016-08-24 09:36:23 -06:00
Joe Topjian beee89c521 provider/openstack: Fix Volume Attachment Detection in Instances
This commit is changing the `volumes` block from being computed to non-computed.
This change makes the Terraform configuration the source of truth about volumes
attached to the instance and therefore is able to correctly detect when a user
detaches a volume during an update.

One thing to be aware of is that if a user attached a volume out of band of an
instance controlled by Terraform, that volume will be detached upon the next
apply. The best thing to do is add a `volume` entry in the instance's
configuration of any volumes that were attached out of band.

This commit also explicitly detaches volumes from an instance before the
instance terminates. Most Block Storage volume drivers account for this
scenario internally, but there are a few that don't. This change is to support
those that don't.

In addition, when volumes are read by the instance, volumes configured in the
Terraform configuration are the source of truth. Previously, a call was being
made to OpenStack to provide the list of attached volumes.

It also adds a few new tests and fixes existing tests for various volume
attach-related scenarios.
2016-08-24 15:21:59 +00:00
James Bardin 056fd70da4 Add locks to state structs for copying
Add locks to the state structs to handle concurrency during the graph
walks. We can't embed the mutexes due to serialization constraints when
communicating with providers, so expose the Lock/Unlock methods
manually.

Use copystructure.LockedCopy to ensure locks are honored.
2016-08-24 11:15:52 -04:00
Jake Champlin 8cbef79dbf Allow specifying ldflags via env vars
Allows specifying `LD_FLAGS` during development builds.

```
$ LD_FLAGS="-linkmode=external" make dev
```

Since the version of DTrace on macOS Sierra (On the public beta's at least) has been updated, this allows DTrace to run on Terraform during development/debugging.

```
$ sudo dtrace -n 'pid$target::main.main:entry' -c "terraform apply"
dtrace: description 'pid$target::main.main:entry' matched 1 probe

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

foo = bar
dtrace: pid 23096 has exited
CPU     ID                    FUNCTION:NAME
  2 265673                  main.main:entry
```

Also redirects the `@which stringer` command inside the `generate` Makefile target to `/dev/null` so we stop echoing the path to the `stringer` binary on every call to `generate`.
2016-08-24 10:56:23 -04:00