Commit Graph

4538 Commits

Author SHA1 Message Date
Paul Stack 743be7914d provider/aws: Refresh CloudWatch Group from state on 404 (#7576)
Fixes #7543 where creating a CloudWatch Group, then deleting it from the
console will cause no action on refresh / plan

```
% make testacc TEST=./builtin/providers/aws  TESTARGS='-run=TestAccAWSCloudWatchLogGroup_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSCloudWatchLogGroup_ -timeout 120m
=== RUN   TestAccAWSCloudWatchLogGroup_importBasic
--- PASS: TestAccAWSCloudWatchLogGroup_importBasic (18.10s)
=== RUN   TestAccAWSCloudWatchLogGroup_basic
--- PASS: TestAccAWSCloudWatchLogGroup_basic (17.34s)
=== RUN   TestAccAWSCloudWatchLogGroup_retentionPolicy
--- PASS: TestAccAWSCloudWatchLogGroup_retentionPolicy (49.81s)
=== RUN   TestAccAWSCloudWatchLogGroup_multiple
--- PASS: TestAccAWSCloudWatchLogGroup_multiple (23.74s)
=== RUN   TestAccAWSCloudWatchLogGroup_disappears
--- PASS: TestAccAWSCloudWatchLogGroup_disappears (15.78s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    124.789s
```
2016-07-11 12:06:44 -06:00
James Nugent 29c1d36cf4 Merge pull request #7571 from hashicorp/import-arm-availset
provider/azurerm: Support Import for `azurerm_availability_set`
2016-07-11 10:35:52 -06:00
James Nugent 4798b13937 Merge pull request #7574 from hashicorp/import-arm-rg
provider/azurerm: Support Import of `azurerm_resource_group`
2016-07-11 10:35:41 -06:00
James Nugent 6cc2a52810 Merge pull request #7578 from hashicorp/import-arm-publicip
provider/azurerm: Support Import for `azurerm_public_ip`
2016-07-11 10:35:18 -06:00
stack72 c28b100233
provider/vsphere: Fix the `vsphere_virtual_machine` tests
The PR that was merged to add `keep_on_destroy` was showing a green
build so was merged but that build happened before another merge adding
another parameter to the tests

FYI @dkalleg - fixes #7169
2016-07-11 16:15:28 +01:00
JB Arsenault fc838be69e Add `destroy_grace_seconds` option to stop container before delete (#7513) 2016-07-11 16:03:02 +01:00
Paul Stack 784a1060e9 Revert "Revert "Adding disk keep_on_remove support on delete case"" 2016-07-11 15:48:34 +01:00
stack72 c9476ea65b
provider/azurerm: Support Import for `azurerm_public_ip`
Had to make some changes to this resource. Params were not being set in
the Read func - also added a statefunc to the IPAddressAllocation as
that was coming back in a different case to how we were sending it. We
need to treat that property as case-insensitive

```
% make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMPublicIpStatic_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
TF_ACC=1 go test ./builtin/providers/azurerm -v
-run=TestAccAzureRMPublicIpStatic_ -timeout 120m
=== RUN   TestAccAzureRMPublicIpStatic_importBasic
--- PASS: TestAccAzureRMPublicIpStatic_importBasic (128.06s)
=== RUN   TestAccAzureRMPublicIpStatic_basic
--- PASS: TestAccAzureRMPublicIpStatic_basic (126.25s)
=== RUN   TestAccAzureRMPublicIpStatic_withTags
--- PASS: TestAccAzureRMPublicIpStatic_withTags (145.99s)
=== RUN   TestAccAzureRMPublicIpStatic_update
--- PASS: TestAccAzureRMPublicIpStatic_update (192.32s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm
592.648s
```
2016-07-11 14:36:23 +01:00
Paul Stack f989009448 Update import_arm_resource_group_test.go 2016-07-11 13:33:39 +01:00
stack72 ef707a89a8
provider/azurerm: Support Import of `azurerm_resource_group`
```
% make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMResourceGroup_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
TF_ACC=1 go test ./builtin/providers/azurerm -v
-run=TestAccAzureRMResourceGroup_ -timeout 120m
=== RUN   TestAccAzureRMResourceGroup_importBasic
--- PASS: TestAccAzureRMResourceGroup_importBasic (92.84s)
=== RUN   TestAccAzureRMResourceGroup_basic
--- PASS: TestAccAzureRMResourceGroup_basic (91.56s)
=== RUN   TestAccAzureRMResourceGroup_withTags
--- PASS: TestAccAzureRMResourceGroup_withTags (110.42s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm
294.832s
```
2016-07-11 12:30:22 +01:00
Tommy Murphy 0c6856f85c digitalocean tag support (#7500)
* vendor: update godo to support tags

* digitalocean: introduce tag resource

* website: update for digitalocean_tag resource
2016-07-11 12:09:06 +01:00
Paul Stack d70b9d334b Revert "Adding disk keep_on_remove support on delete case" (#7572) 2016-07-11 00:50:09 +03:00
dkalleg 95c0a74df7 Adding disk keep_on_remove support on delete case (#7169)
This both fixes the keep_on_remove reference in the disk update case
as well as adds logic to safely eject disks in the destroy case.
2016-07-11 00:36:59 +03:00
stack72 f78f0434cd
provider/azurerm: Support Import for `azurerm_availability_set`
```
% make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMAvailabilitySet_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
TF_ACC=1 go test ./builtin/providers/azurerm -v
-run=TestAccAzureRMAvailabilitySet_ -timeout 120m
=== RUN   TestAccAzureRMAvailabilitySet_importBasic
--- PASS: TestAccAzureRMAvailabilitySet_importBasic (150.75s)
=== RUN   TestAccAzureRMAvailabilitySet_basic
--- PASS: TestAccAzureRMAvailabilitySet_basic (103.37s)
=== RUN   TestAccAzureRMAvailabilitySet_withTags
--- PASS: TestAccAzureRMAvailabilitySet_withTags (137.65s)
=== RUN   TestAccAzureRMAvailabilitySet_withDomainCounts
--- PASS: TestAccAzureRMAvailabilitySet_withDomainCounts (88.78s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm
480.564s
```
2016-07-10 22:33:02 +01:00
Paul Hinze 14cea95e86
terraform: another set of ignore_changes fixes
This set of changes addresses two bug scenarios:

(1) When an ignored change canceled a resource replacement, any
downstream resources referencing computer attributes on that resource
would get "diffs didn't match" errors. This happened because the
`EvalDiff` implementation was calling `state.MergeDiff(diff)` on the
unfiltered diff. Generally this is what you want, so that downstream
references catch the "incoming" values. When there's a potential for the
diff to change, thought, this results in problems w/ references.

Here we solve this by doing away with the separate `EvalNode` for
`ignore_changes` processing and integrating it into `EvalDiff`. This
allows us to only call `MergeDiff` with the final, filtered diff.

(2) When a resource had an ignored change but was still being replaced
anyways, the diff was being improperly filtered. This would cause
problems during apply when not all attributes were available to perform
the replacement.

We solve that by deferring actual attribute removal until after we've
decided that we do not have to replace the resource.
2016-07-08 16:48:23 -05:00
James Nugent 8beafe25ae provisioner/file: Clean up temporary files 2016-07-08 19:35:00 +01:00
jorge.marey 9b065f32e2 Include content option for file provisioner
- Include new option in file provisioner. Now content or source can be
  provided. Content will create a temp file and copy there the contents.
- Later that file will be used as source.
- Include test to check that changes are working correctly.
2016-07-08 19:34:59 +01:00
Martin Atkins 861ac536dd provider/template: convert resources to data sources
The template resources don't actually need to retain any state, so they
are good candidates to be data sources.

This includes a few tweaks to the acceptance tests -- now configured to
run as unit tests -- since it seems that they have been slightly broken
for a while now. In particular, the "update" cases are no longer tested
because updating is not a meaningful operation for a data source.
2016-07-08 17:11:17 +01:00
James Nugent 46e3cacee3 Merge pull request #7469 from hashicorp/f-tls-data-source
Convert tls_cert_request to be a data source
2016-07-08 17:06:43 +01:00
James Nugent 4c05fddd9b Merge pull request #7530 from hashicorp/aws-codedeployment-manual
provider/aws: Remove `aws_codedeploy_deployment_group` from state on 404
2016-07-08 11:05:06 +01:00
James Nugent 73682c93a7 Merge pull request #7541 from hashicorp/import-aws-redshiftcluster
provider/aws: Support Import of `aws_redshift_cluster`
2016-07-08 11:01:28 +01:00
James Nugent 66a2fe61a4 Merge pull request #7540 from hashicorp/import-aws-receiptfilter
provider/aws: Support Import of `aws_ses_receipt_filter`
2016-07-08 11:00:36 +01:00
James Nugent f5bb652bd6 Merge pull request #7539 from hashicorp/import-aws-receiptruleset
provider/aws: Support Import of `aws_ses_receipt_rule_set`
2016-07-08 11:00:17 +01:00
James Nugent a89fd9d0de Merge pull request #7537 from hashicorp/import-aws-dboption
provider/aws: Support Import of `aws_db_option_group`
2016-07-08 10:59:00 +01:00
James Nugent dfe2ee5a30 Merge pull request #7536 from hashicorp/import-aws-db_instance
provider/aws: Support Import of `aws_db_instance`
2016-07-08 10:58:37 +01:00
David Tolnay db627798e6 provider/aws: Handle spurious failures in resourceAwsSecurityGroupRuleRead (#7377)
Previously, any old HTTP error would be treated as the security_group_rule being
deleted. In reality there are only a few cases where this is the right
assumption.
2016-07-07 16:06:02 -05:00
James Bardin 4c602d1eb9 Merge pull request #7521 from hashicorp/jbardin/GH-7509
Revert #7464 and allow an empty state
2016-07-07 17:00:08 -04:00
David Tolnay a86d766bd2 provider/aws: internetgateway timing tweaks (again) (#7447)
This workaround is originally from 71b30c633f.
According to the commit message from Mitchell Hashimoto:

    So I think the AWS API is just broken here. In the case that the state
    doesn't update, just assume it did after 5 seconds.

Based on my experience, this AWS API is still broken in the same way.

The timeout was later increased from 5 seconds to 10 seconds in
265cc4fffa.

The timeout (but not the timer) was removed inexplicably in GH-1325.

The symptom is this error from `terraform apply`:

    aws_internet_gateway.test: Error waiting for internet gateway (igw-553b4731) to attach: timeout while waiting for state to become '[available]'

followed by all subsequent `terraform apply` commands failing with this error:

    aws_internet_gateway.test: Resource.AlreadyAssociated: resource igw-553b4731 is already attached to network vpc-61bc7606
2016-07-07 15:45:28 -05:00
David Tolnay 2943a1c978 Retry creation of IAM role depending on new IAM user (#7324) 2016-07-07 15:24:17 -05:00
James Bardin 2c27dd41bf Fix panic when there is no remote state
- Check for an empty state. If nothing is referenced from that state in
  the config, there's nothing to do here.
2016-07-07 16:20:35 -04:00
stack72 a746b28fc1
provider/aws: Support Import of `aws_redshift_cluster`
```
make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSRedshiftCluster_importBasic'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSRedshiftCluster_importBasic -timeout 120m
=== RUN   TestAccAWSRedshiftCluster_importBasic
--- PASS: TestAccAWSRedshiftCluster_importBasic (623.52s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    623.546s
```
2016-07-07 18:27:13 +01:00
Clint 17931c7099 Merge pull request #7511 from hashicorp/pr-7319
provider/aws: AWS prefix lists to enable security group egress to a VPC Endpoint (supersedes #7319)
2016-07-07 12:10:10 -05:00
stack72 a74bd870e2
provider/aws: Support Import of `aws_ses_receipt_filter`
```
% make testacc TEST=./builtin/providers/aws  TESTARGS='-run=TestAccAWSSESReceiptFilter_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSSESReceiptFilter_ -timeout 120m
=== RUN   TestAccAWSSESReceiptFilter_importBasic
--- PASS: TestAccAWSSESReceiptFilter_importBasic (18.18s)
=== RUN   TestAccAWSSESReceiptFilter_basic
--- PASS: TestAccAWSSESReceiptFilter_basic (18.42s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    36.633s
```
2016-07-07 17:37:56 +01:00
stack72 aa6e23bc4b
provider/aws: Support Import of `aws_ses_receipt_rule_set`
```
make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSESReceiptRuleSet_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSSESReceiptRuleSet_ -timeout 120m
=== RUN   TestAccAWSSESReceiptRuleSet_importBasic
--- PASS: TestAccAWSSESReceiptRuleSet_importBasic (18.60s)
=== RUN   TestAccAWSSESReceiptRuleSet_basic
--- PASS: TestAccAWSSESReceiptRuleSet_basic (26.92s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    45.550s
```
2016-07-07 17:30:03 +01:00
stack72 6f122c3f05
provider/aws: Support Import of `aws_db_option_group`
```
make testacc TEST=./builtin/providers/aws
TESTARGS='-run=TestAccAWSDBOptionGroup_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v
-run=TestAccAWSDBOptionGroup_ -timeout 120m
=== RUN   TestAccAWSDBOptionGroup_importBasic
--- PASS: TestAccAWSDBOptionGroup_importBasic (22.98s)
=== RUN   TestAccAWSDBOptionGroup_basic
--- PASS: TestAccAWSDBOptionGroup_basic (22.54s)
=== RUN   TestAccAWSDBOptionGroup_OptionSettings
--- PASS: TestAccAWSDBOptionGroup_OptionSettings (38.62s)
=== RUN   TestAccAWSDBOptionGroup_sqlServerOptionsUpdate
--- PASS: TestAccAWSDBOptionGroup_sqlServerOptionsUpdate (37.64s)
=== RUN   TestAccAWSDBOptionGroup_multipleOptions
--- PASS: TestAccAWSDBOptionGroup_multipleOptions (24.32s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    146.123s
```
2016-07-07 16:45:56 +01:00
stack72 80aeabec83
provider/aws: Support Import of `aws_db_instance`
JUst needed some rejigging of the skip_final_snapshot work as that isn't
returned by the API and skipping it means the destroy fails due to
missing final_snapshot_identifier

```
% make testacc TEST=./builtin/providers/aws
% TESTARGS='-run=TestAccAWSDBInstance_'                              ✹ ✭
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /vendor/)
2016/07/07 15:28:31 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSDBInstance_
-timeout 120m
=== RUN   TestAccAWSDBInstance_importBasic
--- PASS: TestAccAWSDBInstance_importBasic (588.70s)
=== RUN   TestAccAWSDBInstance_basic
--- PASS: TestAccAWSDBInstance_basic (595.71s)
=== RUN   TestAccAWSDBInstance_kmsKey
--- PASS: TestAccAWSDBInstance_kmsKey (726.46s)
=== RUN   TestAccAWSDBInstance_optionGroup
--- PASS: TestAccAWSDBInstance_optionGroup (681.78s)
=== RUN   TestAccAWSDBInstance_iops_update
--- PASS: TestAccAWSDBInstance_iops_update
(590.81s)
```

Please note that I cannot run the enhanced monitoring test in my
environment as I have already got it attached to an IAM role. Running
that test gives me this result:

```

```
2016-07-07 16:26:35 +01:00
stack72 53681390d4
provider/aws: Remove `aws_codedeploy_deployment_group` from state on 404
Fixes #4802

The manual removal will now force Terraform to remove the resource from
state and then report it needs recreated
2016-07-07 13:59:39 +01:00
clint shryock 1d488bdbd2 provider/aws: Do an extra lookup for the VPC Endpoint Prefix, to test Prefix 2016-07-06 09:20:39 -05:00
David Tolnay 4ba75bd54e Retry finding route after creating it (#7463)
The symptom is that a route "fails" to create, then every subsequent
`terraform apply` fails with RouteAlreadyExists.

CreateRoute was succeeding but the very next DescribeRouteTables
was not listing the new route.
2016-07-05 15:04:09 -05:00
Paul Stack d60594695f provider/aws: `aws_customer_gateway` refreshing from state on deleted (#7482)
state

Fixes #7136
2016-07-05 16:34:06 +01:00
Paul Stack 58c324676d provider/aws: Add support for `encryption` and `kms_key_id` to `aws_ami` (#7181)
This fixes #7157. It doesn't change the way aws_ami works

```
make testacc TEST=./builtin/providers/aws
TESTARGS='-run=TestAccAWSAMICopy'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAMICopy
-timeout 120m
=== RUN   TestAccAWSAMICopy
--- PASS: TestAccAWSAMICopy (479.75s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    479.769s
```
2016-07-05 09:50:48 -05:00
Paul Stack 06ff7bfcfe provider/aws: Remove EFS File System from State when NotFound (#7437)
Fixes #7433

When an EFS File System is created via Terraform, Deleted from the AWS
console, then Terraform would give us as error as:

```
* aws_efs_file_system.file_system: FileSystemNotFound: File system
 'fs-9d739e54' does not exist.
        status code: 404, request id:
        d505a682-3ec7-11e6-81d3-1d41202f0881
```

On a 404, we now remove the EFS File System from state so that Terraform
can recreate it as expected
2016-07-05 13:56:05 +01:00
James Nugent 730d59734f Merge pull request #7338 from hashicorp/import-aws-dbpg
provider/aws: Support Import for `aws_db_parameter_group`
2016-07-05 13:51:51 +01:00
Radek Simko 120d7c4f2e provider/aws: Only allow max. 1 health_check block for ELB 2016-07-05 10:56:17 +01:00
Eric Rutherford 32051156c7 adding states that should be considered as deleted for vpc peering (#7466) 2016-07-03 16:58:19 +01:00
David Harris c744bb6fa8 provider/aws: import Elastic Beanstalk Application and Environment (#7444) 2016-07-03 16:42:12 +01:00
Joe Topjian 480542d2ab provider/openstack: Support Import openstack_compute_keypair_v2 (#7346) 2016-07-03 16:39:20 +01:00
Joe Topjian 713c0daa52 provider/openstack: Support Import openstack_compute_floatingip_v2 (#7348) 2016-07-03 16:38:38 +01:00
Joe Topjian 0466520626 provider/openstack: Support Import openstack_compute_servergroup_v2 (#7349) 2016-07-03 16:38:21 +01:00
Joe Topjian c1e4d297f3 provider/openstack: Support Import openstack_compute_secgroup_v2 (#7350) 2016-07-03 16:37:58 +01:00
Joe Topjian 8d8becdfdb provider/openstack: Support Import of OpenStack FWaaS Resources (#7471) 2016-07-03 16:37:35 +01:00
Paul Stack 421bda23b0 provider/azurerm: `azurerm_virtual_machine` panic at UnattendConfig (#7453)
Guarding against `invalid memory address` in AdditionalUnattendConfig

```
make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMVirtualMachine_windowsUnattendedConfig'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/azurerm -v
-run=TestAccAzureRMVirtualMachine_windowsUnattendedConfig -timeout 120m
=== RUN   TestAccAzureRMVirtualMachine_windowsUnattendedConfig
--- PASS: TestAccAzureRMVirtualMachine_windowsUnattendedConfig (943.28s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm
943.299s
```
2016-07-03 11:31:35 +01:00
Joe Topjian b5ca75f165 Merge pull request #7468 from jtopjian/openstack-secgroup-eof
provider/openstack: Fix Security Group EOF Error
2016-07-02 11:50:32 -06:00
Martin Atkins c244e5a668 Convert tls_cert_request to be a data source
This resource (unlike the others in this provider) isn't stateful, so it
is a good candidate to be a data source.

The old resource form is preserved via the standard shim in helper/schema,
which will generate a deprecation warning but will still allow the
resource to be used.
2016-07-02 08:07:53 -07:00
Joe Topjian bc6be73c1d provider/openstack: Fix Security Group EOF Error
When applying or removing 2+ security groups from an instance, an EOF
error will be triggered even though the action was successful. This
patch accounts for and ignores the EOF error. It also adds a test
case.

Security Group and Port documentation are also updated in this
commit.
2016-07-02 14:18:04 +00:00
Paul Stack c965d9bea4 provider/azurerm: Add `azurerm_virtual_machine` Acceptance Test for (#7456)
`storage_data_disk`

```
make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMVirtualMachine_withDataDisk'
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /vendor/)
2016/07/01 15:47:13 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/azurerm -v
-run=TestAccAzureRMVirtualMachine_withDataDisk -timeout 120m
=== RUN   TestAccAzureRMVirtualMachine_withDataDisk
--- PASS: TestAccAzureRMVirtualMachine_withDataDisk (575.39s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm
```
2016-07-02 07:55:36 +01:00
Joe Topjian de99379a87 Merge pull request #7422 from jtopjian/openstack-lbpoolmember-deprecated
provider/openstack: Deprecate openstack_lb_pool_v1 member attribute
2016-07-01 20:37:23 -06:00
David Tolnay be7162747f Remove unused variables 2016-07-01 13:37:48 -07:00
Paul Hinze 3b732131d2 Merge pull request #7446 from hashicorp/b-jit-resource-validate
core: rerun resource validation before plan and apply
2016-07-01 15:00:40 -05:00
Paul Hinze afccf62e3e Merge pull request #7459 from hashicorp/r-resource-unit-test
helper/resource: Consolidate unit test override
2016-07-01 13:23:13 -05:00
Paul Hinze 4a1b36ac0d
core: rerun resource validation before plan and apply
In #7170 we found two scenarios where the type checking done during the
`context.Validate()` graph walk was circumvented, and the subsequent
assumption of type safety in the provider's `Diff()` implementation
caused panics.

Both scenarios have to do with interpolations that reference Computed
values. The sentinel we use to indicate that a value is Computed does
not carry any type information with it yet.

That means that an incorrect reference to a list or a map in a string
attribute can "sneak through" validation only to crop up...

 1. ...during Plan for Data Source References
 2. ...during Apply for Resource references

In order to address this, we:

 * add high-level tests for each of these two scenarios in `provider/test`
 * add context-level tests for the same two scenarios in `terraform`
   (these tests proved _really_ tricky to write!)
 * place an `EvalValidateResource` just before `EvalDiff` and `EvalApply` to
   catch these errors
 * add some plumbing to `Plan()` and `Apply()` to return validation
   errors, which were previously only generated during `Validate()`
 * wrap unit-tests around `EvalValidateResource`
 * add an `IgnoreWarnings` option to `EvalValidateResource` to prevent
   active warnings from halting execution on the second-pass validation

Eventually, we might be able to attach type information to Computed
values, which would allow for these errors to be caught earlier. For
now, this solution keeps us safe from panics and raises the proper
errors to the user.

Fixes #7170
2016-07-01 13:12:57 -05:00
Paul Hinze 5656d7388c
helper/resource: Consolidate unit test override
I noticed we had two mechanisms for unit test override. One that dropped
a sentinel into the env var, and another with a struct member on
TestCase. This consolidates the two, using the cleaner struct member
internal mechanism and the nicer `resource.UnitTest()` entry point.
2016-07-01 13:08:43 -05:00
Clint 98fd603bdf provider/atlas: Add a Atlas Artifact Data Source (#7419)
* small doc update

* provider/atlas: Add docs for Artifact Data Source

* provider/atlas: Remove a test method that isn't used

* provider/atlas: Add Data Source for Atlas Artifact

* provider/atlas: Show deprecation error on atlas_artifact resource
2016-07-01 10:29:53 -05:00
clint shryock c4fa91b176 Merge branch 'pr-5939'
* pr-5939:
  Update acc tests
  provider/aws: Allow `aws_redshift_security_group` ingress rules to change
2016-07-01 10:15:29 -05:00
clint shryock 1d1cc9b572 Update acc tests 2016-07-01 10:14:18 -05:00
Clint 6367bade03 Merge pull request #6851 from TeaBough/master
provider/aws: Handled case when instanceId is absent in network interfaces
2016-07-01 09:42:35 -05:00
Paul Stack 7f948f0ca7 provider/azurerm: `azurerm_dns_zone` now returns `name_servers` (#7434)
Fixes #7374

The introduction of the AzureRM SDK 3.0.0-beta means that the
`name_servers` for the DNS Zone are returned from the API

This PR has a dependency on #7420 being merged first

```
make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMDnsZone_'
==> Checking that code complies with gofmt requirements...
/Users/stacko/Code/go/bin/stringer
go generate $(go list ./... | grep -v /vendor/)
2016/06/30 15:20:01 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/azurerm -v
-run=TestAccAzureRMDnsZone_ -timeout 120m
=== RUN   TestAccAzureRMDnsZone_basic
--- PASS: TestAccAzureRMDnsZone_basic (92.42s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/azurerm
92.444s
```
2016-07-01 10:26:01 +01:00
Paul Stack 54c0022d38 Revert "provider/aws: Read Elastic Beanstalk stack name" (#7452) 2016-07-01 10:03:31 +01:00
David Harris a347b1795f provider/aws: Read Elastic Beanstalk stack name (#7445) 2016-07-01 09:34:28 +01:00
stevehorsfield 03c2c4408f Add support for 'prefix_list_ids' to AWS VPC security group rules
Prefix list IDs are used when allowing egress to an AWS VPC Endpoint.

See http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-endpoints.html#vpc-endpoints-routing
2016-06-30 15:48:27 -07:00
stevehorsfield db5f450a3e Add 'prefix_list_id' exported attribute to AWS VPC Endpoint
'prefix_list_id' can be used in egress rules in VPC security groups.
2016-06-30 15:47:53 -07:00
stevehorsfield 29623f871b Split TestAccAWSSecurityGroup_DefaultEgress into VPC/Classic
This test function tests both VPC and Classic EC2 modes, but not
all accounts have support for both. Splitting them makes it
easier to understand why a test fails when an account only
supports the VPC mode.
2016-06-30 15:47:53 -07:00
Clint 14fa3a88fd provider/aws: Added support for redshift destination to firehose delivery streams (supersedes #5304) (#7375)
* Added support for redshift destination to firehose delivery streams

* Small documentation fix

* go fmt after rebase

* small fixes after rebase

* provider/aws: Firehose test cleanups

* provider/aws: Update docs

* Convert Redshift and S3 blocks to TypeList

* provider/aws: Add migration for S3 Configuration in Kinesis firehose

* providers/aws: Safety first when building Redshift config options

* restore commented out log statements in the migration

* provider/aws: use MaxItems in schema
2016-06-30 15:03:31 -05:00
Clint 2ba1b0fb01 provider/aws: Populate self in Security Group Rule imports (#7164)
* provider/aws: Populate self in Security Group Rule imports

* provider/aws: Add regression test for SG Rule import
2016-06-30 15:01:38 -05:00
Paul Stack 079e1f9a56 provider/azurerm: Bump azure-sdk-for-go to 3.0.0-beta (#7420)
provider/azurerm: Bump azure-sdk-for-go to 3.0.0-beta
2016-06-30 15:36:08 +01:00
Joakim Sernbrant 1b4c1ab83a provider/cloudstack: do not force a new resource when updating instance user_data 2016-06-30 14:23:43 +02:00
Radek Simko b54481909b Merge pull request #7428 from TimeIncOSS/f-efs-target-hostname
provider/aws: Add dns_name to aws_efs_mount_target
2016-06-30 12:40:48 +01:00
Radek Simko 32019fa008 provider/aws: Add dns_name to aws_efs_mount_target 2016-06-30 11:24:18 +01:00
Joe Topjian 4ca5c948b6 provider/openstack: Deprecate openstack_lb_pool_v1 member attribute
This commit marks the "member" attribute of the
openstack_lb_pool_v1 resource as being deprecated. Users should begin
migrating to the openstack_lb_member_v1 resource.
2016-06-30 02:12:15 +00:00
Clint dd0850af59 provider/aws: Add inplace edit/update DB Security Group Rule Ingress (#7245) 2016-06-29 15:55:58 -05:00
Eloy Coto ab390359be Vsphere: Added uuid attributes (#4382) 2016-06-29 21:45:59 +01:00
Paul Stack e905aa2840 provider/digitalocean: Support Import `digitalocean_droplet` (#7344)
```
ake testacc TEST=./builtin/providers/digitalocean
TESTARGS='-run=TestAccDigitalOceanDroplet_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/digitalocean -v -run=TestAccDigitalOceanDroplet_ -timeout 120m
=== RUN   TestAccDigitalOceanDroplet_importBasic
--- PASS: TestAccDigitalOceanDroplet_importBasic (39.42s)
=== RUN   TestAccDigitalOceanDroplet_Basic
--- PASS: TestAccDigitalOceanDroplet_Basic (38.46s)
=== RUN   TestAccDigitalOceanDroplet_Update
--- PASS: TestAccDigitalOceanDroplet_Update (244.82s)
=== RUN   TestAccDigitalOceanDroplet_UpdateUserData
--- PASS: TestAccDigitalOceanDroplet_UpdateUserData (73.05s)
=== RUN   TestAccDigitalOceanDroplet_PrivateNetworkingIpv6
--- PASS: TestAccDigitalOceanDroplet_PrivateNetworkingIpv6 (67.24s)
PASS
```
2016-06-29 20:28:47 +01:00
dkalleg ab92fa4dff Refreshing devices list after adding a disk or cdrom controller (#7167)
Also taking out an unnecessary ForceNew on controller_type as well
as correcting a reference to controller_type in Update case.
2016-06-29 19:47:56 +01:00
Paul Stack c25eb9b4b8 provider/vsphere: Make `vsphere_virtual_machine` `product_key` optional (#7410)
Fixes #6690

Luckily, the code was already checking to see if the product_key was
specified
2016-06-29 19:37:04 +01:00
Paul Stack 70578d4e99 provider/digitalocean: Support Import `digitalocean_floating_ip` (#7343)
```
make testacc TEST=./builtin/providers/digitalocean
TESTARGS='-run=TestAccDigitalOceanFloatingIP_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/digitalocean -v -run=TestAccDigitalOceanFloatingIP_ -timeout 120m
=== RUN   TestAccDigitalOceanFloatingIP_importBasicRegion
--- PASS: TestAccDigitalOceanFloatingIP_importBasicRegion (3.76s)
=== RUN   TestAccDigitalOceanFloatingIP_importBasicDroplet
--- PASS: TestAccDigitalOceanFloatingIP_importBasicDroplet (72.41s)
=== RUN   TestAccDigitalOceanFloatingIP_Region
--- PASS: TestAccDigitalOceanFloatingIP_Region (3.46s)
=== RUN   TestAccDigitalOceanFloatingIP_Droplet
--- PASS: TestAccDigitalOceanFloatingIP_Droplet (74.49s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/digitalocean
154.128s
```
2016-06-29 16:30:11 +01:00
Paul Stack bc163cadaa provider/digitalocean: Support Import `digitalocean_domain` (#7342)
```
make testacc TEST=./builtin/providers/digitalocean
TESTARGS='-run=TestAccDigitalOceanDomain_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/digitalocean -v -run=TestAccDigitalOceanDomain_ -timeout 120m
=== RUN   TestAccDigitalOceanDomain_importBasic
--- PASS: TestAccDigitalOceanDomain_importBasic (3.07s)
=== RUN   TestAccDigitalOceanDomain_Basic
--- PASS: TestAccDigitalOceanDomain_Basic (1.99s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/digitalocean
5.072s
```
2016-06-29 16:10:56 +01:00
Paul Stack ae2bd7a0ff provider/digitalocean: Support Import `digitalocean_ssh_key` (#7345)
```
make testacc TEST=./builtin/providers/digitalocean
TESTARGS='-run=TestAccDigitalOceanSSHKey_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/digitalocean -v -run=TestAccDigitalOceanSSHKey_ -timeout 120m
=== RUN   TestAccDigitalOceanSSHKey_importBasic
--- PASS: TestAccDigitalOceanSSHKey_importBasic (2.13s)
=== RUN   TestAccDigitalOceanSSHKey_Basic
--- PASS: TestAccDigitalOceanSSHKey_Basic (1.52s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/digitalocean
3.665s
```
2016-06-29 16:09:34 +01:00
Paul Stack 7a1b78593b provider/digitalocean: Reassign Floating IP when droplet changes (#7411)
Fixes #6673

When a floating IP is changed in the DO console, this PR will allow it
to be reassociated to the machine that Terraform attached it to and
change it back
2016-06-29 16:05:36 +01:00
Daniel Portella 21618a9111 provider/docker: Docker documentation and additional test message (#7412)
* added additional error info for when memory swap assert fails.

related to https://github.com/hashicorp/terraform/pull/7392

* updated docker_container documentation

reflect recent changes to docker provider around tests, dns options and
dns search support.

* Grammar and punctuation changes

Docker container documentation.

* Spell checking, grammar and punctuation.

Docker container documentation.

* Markdown change sto docker container documentation
2016-06-29 15:48:15 +01:00
Daniel Portella b8a84691ec provider/docker: Docker DNS Setting Enhancements (#7392)
* fixed go vet issues on aws provider in  master

* added support for dns, dns options and dns search for docker container.

On docker container resource you can specify dns_opts nad dns_search
which maps directly to docker --dns_opt and --dns_search parameters.
Allowing users to setup the embedded dns settings for their containers.

* fixed the asserts for the new features in tests.

fixed tests around DNS, DNS_OPTS and DNS_SEARCH
2016-06-29 13:38:46 +01:00
David Lanner 8fd843fa91 correct true and false string values to fix manage_bundler config bug (#7219) 2016-06-29 09:51:26 +01:00
stack72 8ca3d94858 provider/docker: Fixing the Docker Container Mount Test
```
make testacc TEST=./builtin/providers/docker TESTARGS='-run=TestAccDockerContainer_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/docker -v
-run=TestAccDockerContainer_ -timeout 120m
=== RUN   TestAccDockerContainer_basic
--- PASS: TestAccDockerContainer_basic (17.25s)
=== RUN   TestAccDockerContainer_volume
--- PASS: TestAccDockerContainer_volume (16.79s)
=== RUN   TestAccDockerContainer_customized
--- PASS: TestAccDockerContainer_customized (19.65s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/docker 53.712s
```
2016-06-29 09:38:56 +01:00
Kevin Crawley a049fb17aa Added support for `snapshot_identifier` parameter in aws_rds_cluster (#7158)
Made modifications to existing parameters to enable restoring a RDS cluster snapshot

document changes
2016-06-29 09:02:26 +01:00
Jason Wieringa 79dd1c7d80 Protect instance from autoscale in on aws_autoscaling_group (#6490)
* Add support for NewInstancesProtectedFromScaleIn on aws_autoscaling_group

* Add documentation for aws_autoscaling_group protect_from_scale_in
2016-06-29 07:36:34 +01:00
David Harris 7abbb0f57e provider/aws: fix Elastic Beanstalk settings diff (#7398)
Fixes an issue where terraform plan or apply will always have a diff.
The Elastic Beanstalk API returns data for the `resource` attribute for
some settings that are not documented. This limits the `resource`
attribute to settings in the `aws:autoscaling:scheduledaction`
namespace.
2016-06-28 22:03:57 +01:00
Paul Stack 5e52bbaa27 provider/aws: Support Import for `aws_redshift_parameter_group` (#7339)
```
make testacc TEST=./builtin/providers/aws
TESTARGS='-run=TestAccAWSRedshiftParameterGroup_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSRedshiftParameterGroup_ -timeout 120m
=== RUN   TestAccAWSRedshiftParameterGroup_importBasic
--- PASS: TestAccAWSRedshiftParameterGroup_importBasic (25.97s)
=== RUN   TestAccAWSRedshiftParameterGroup_withParameters
--- PASS: TestAccAWSRedshiftParameterGroup_withParameters (21.26s)
=== RUN   TestAccAWSRedshiftParameterGroup_withoutParameters
--- PASS: TestAccAWSRedshiftParameterGroup_withoutParameters (20.79s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    68.045s
```
2016-06-28 10:05:03 -05:00
Paul Stack e45437373c provider/aws: Support Import `aws_vpc_peering_connection` (#7357)
```
make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSVPCPeeringConnection_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSVPCPeeringConnection_ -timeout 120m
=== RUN   TestAccAWSVPCPeeringConnection_importBasic
--- PASS: TestAccAWSVPCPeeringConnection_importBasic (42.58s)
=== RUN   TestAccAWSVPCPeeringConnection_basic
--- PASS: TestAccAWSVPCPeeringConnection_basic (45.00s)
=== RUN   TestAccAWSVPCPeeringConnection_plan
--- PASS: TestAccAWSVPCPeeringConnection_plan (40.92s)
=== RUN   TestAccAWSVPCPeeringConnection_tags
--- SKIP: TestAccAWSVPCPeeringConnection_tags (0.00s)
	resource_aws_vpc_peering_connection_test.go:85: Error: TestAccAWSVPCPeeringConnection_tags requires a peer id to be set
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	128.517s
```
2016-06-28 10:04:11 -05:00
Paul Stack 92fe1c82fc provider/aws: Support Import `aws_api_gateway_account` (#7368)
```
make testacc TEST=./builtin/providers/aws
TESTARGS='-run=TestAccAWSAPIGatewayAccount_importBasic'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSAPIGatewayAccount_importBasic -timeout 120m
=== RUN   TestAccAWSAPIGatewayAccount_importBasic
--- PASS: TestAccAWSAPIGatewayAccount_importBasic (16.43s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    16.450s
```
2016-06-28 10:03:24 -05:00
Paul Stack 0c16031556 provider/aws: Support Import `aws_elasticache_parameter_group` resource (#7336)
* provider/aws: Support Import `aws_elasticache_parameter_group` resource

```
make testacc TEST=./builtin/providers/aws
TESTARGS='-run=TestAccAWSElasticacheParameterGroup_'
==> Checking that code complies with gofmt requirements...
2016/06/26 19:46:35 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSElasticacheParameterGroup_ -timeout 120m
=== RUN   TestAccAWSElasticacheParameterGroup_importBasic
--- PASS: TestAccAWSElasticacheParameterGroup_importBasic (22.42s)
=== RUN   TestAccAWSElasticacheParameterGroup_basic
--- PASS: TestAccAWSElasticacheParameterGroup_basic (39.08s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    61.520s
```

* Update import_aws_elasticache_parameter_group_test.go
2016-06-28 10:02:43 -05:00
clint shryock e262f0d015 provider/aws: Retry Code Deployment Group update based on IAM issues 2016-06-28 09:54:07 -05:00