Commit Graph

4977 Commits

Author SHA1 Message Date
Paul Stack 39875ebf65 Merge pull request #8596 from hashicorp/librato-space-already-deleted
provider/librato: Refresh space from state when not found
2016-09-01 18:35:43 +01:00
Paul Stack 94f9e1d4ab Merge pull request #8607 from hashicorp/arm-reorder-get-request-checks
provider/azurerm: Reordering the checks after an Azure API Get
2016-09-01 18:04:24 +01:00
stack72 392f634ff4
provider/azurerm: Reordering the checks after an Azure API Get
We are receiving suggestions of a panic as follows:

```
2016/09/01 07:21:55 [DEBUG] plugin: terraform: panic: runtime error: invalid memory address or nil pointer dereference
2016/09/01 07:21:55 [DEBUG] plugin: terraform: [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0xa3170f]
2016/09/01 07:21:55 [DEBUG] plugin: terraform:
2016/09/01 07:21:55 [DEBUG] plugin: terraform: goroutine 114 [running]:
2016/09/01 07:21:55 [DEBUG] plugin: terraform: panic(0x27f4e60, 0xc4200100e0)
2016/09/01 07:21:55 [DEBUG] plugin: terraform: 	/opt/go/src/runtime/panic.go:500 +0x1a1
2016/09/01 07:21:55 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/builtin/providers/azurerm.resourceArmVirtualMachineRead(0xc4206d8060, 0x2995620, 0xc4204d0000, 0x0, 0x17)
2016/09/01 07:21:55 [DEBUG] plugin: terraform: 	/opt/gopath/src/github.com/hashicorp/terraform/builtin/providers/azurerm/resource_arm_virtual_machine.go:488 +0x1ff
2016/09/01 07:21:55 [DEBUG] plugin: terraform: github.com/hashicorp/terraform/helper/schema.(*Resource).Refresh(0xc420017a40, 0xc42040c780, 0x2995620, 0xc4204d0000, 0xc42019c990, 0x1, 0x0)
```

This is because the code is as follows:

```
resp, err := client.Get(resGroup, vnetName, name)
if resp.StatusCode == http.StatusNotFound {
	d.SetId("")
	return nil
}
if err != nil {
	return fmt.Errorf("Error making Read request on Azure virtual network peering %s: %s", name, err)
}
```

When a request throws an error, the response object isn't valid. Therefore, we need to flip that code to check the error first

```
resp, err := client.Get(resGroup, vnetName, name)
if err != nil {
	return fmt.Errorf("Error making Read request on Azure virtual network peering %s: %s", name, err)
}
if resp.StatusCode == http.StatusNotFound {
	d.SetId("")
	return nil
}
```
2016-09-01 15:31:42 +01:00
Paul Stack bf755bb5c9 Merge pull request #8585 from hashicorp/f-diff-suppression
helper/schema: Add diff suppression callback
2016-09-01 14:46:03 +01:00
Juan Carlos Alonso cab71c98cd Minor typos 2016-09-01 11:30:55 +01:00
Sander van Harmelen 1a85d06843 Fix the acceptance tests and some cosmetic tweaks (#8598) 2016-09-01 11:19:37 +02:00
Bart van der Schans 0835b64456 Add ability to manage cloudstack affinity groups (#8360)
Add documentation for cloudstack affinity group resource

Implement improvements from review by svanharmelen

Update to latest go-cloudstack v2.1.3
2016-09-01 10:48:49 +02:00
stack72 4abfff21c0
provider/librato: Refresh space from state when not found
The librator provider is sometimes throwing errors when trying to delete
a space that is already deleted. The nightly tests shows this error:

```
Error: Error applying: 1 error(s) occurred:

                * librato_space.foobar: Error deleting space: DELETE
                * https://metrics-api.librato.com/v1/spaces/236303: 404
                * Request errors: Not Found,.
```

The Delete func should be aware if the space cannot be deleted as it is
already deleted and not error on this usecase

```
% make testacc TEST=./builtin/providers/librato TESTARGS='-run=Test'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/09/01 09:24:21 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/librato -v -run=Test -timeout 120m
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN   TestAccLibratoAlert_Basic
--- PASS: TestAccLibratoAlert_Basic (1.52s)
=== RUN   TestAccLibratoAlert_Full
--- PASS: TestAccLibratoAlert_Full (2.89s)
=== RUN   TestAccLibratoAlert_Updated
--- PASS: TestAccLibratoAlert_Updated (1.76s)
=== RUN   TestAccLibratoService_Basic
--- PASS: TestAccLibratoService_Basic (2.09s)
=== RUN   TestAccLibratoService_Updated
--- PASS: TestAccLibratoService_Updated (2.73s)
=== RUN   TestAccLibratoSpaceChart_Basic
--- PASS: TestAccLibratoSpaceChart_Basic (5.08s)
=== RUN   TestAccLibratoSpaceChart_Full
--- PASS: TestAccLibratoSpaceChart_Full (13.06s)
=== RUN   TestAccLibratoSpaceChart_Updated
--- PASS: TestAccLibratoSpaceChart_Updated (5.90s)
=== RUN   TestAccLibratoSpace_Basic
--- PASS: TestAccLibratoSpace_Basic (4.29s)
PASS
ok     	github.com/hashicorp/terraform/builtin/providers/librato       	39.321s
```
2016-09-01 09:25:53 +01:00
Mitchell Hashimoto c6ad7f80e8
providers/template: template_file supports floating point math 2016-08-31 17:25:11 -07:00
James Nugent 85ec09111b helper/schema: Add diff suppression callback
This commit adds a new callback, DiffSuppressFunc, to  the schema.Schema
structure. If set for a given schema, a callback to the user-supplied
function will be made for each attribute for which the default
type-based diff mechanism produces an attribute diff. Returning `true`
from the callback will suppress the diff (i.e. pretend there was no
diff), and returning false will retain it as part of the plan.

There are a number of motivating examples for this - one of which is
included as an example:

1. On SSH public keys, trailing whitespace does not matter in many
   cases - and in some cases it is added by provider APIs. For
   digitalocean_ssh_key resources we previously had a StateFunc that
   trimmed the whitespace - we now have a DiffSuppressFunc which
   verifies whether the trimmed strings are equivalent.

2. IAM policy equivalence for AWS. A good proportion of AWS issues
   relate to IAM policies which have been "normalized" (used loosely)
   by the IAM API endpoints. This can make the JSON strings differ
   from those generated by iam_policy_document resources or template
   files, even though the semantics are the same (for example,
   reordering of `bucket-prefix/` and `bucket-prefix/*` in an S3
   bucket policy. DiffSupressFunc can be used to test for semantic
   equivalence rather than pure text equivalence, but without having to
   deal with the complexity associated with a full "provider-land" diff
   implementation without helper/schema.
2016-08-31 19:13:53 -05:00
stack72 32ad2218cb
provider/librato: Fixing some go vet issues for the
`resourceLibratoAlertConditionsHash`
2016-08-31 21:45:03 +01:00
stack72 a6c55ddea9
Merge branch 'librato-alerts' of https://github.com/elblivion/terraform into elblivion-librato-alerts 2016-08-31 20:14:52 +01:00
Mitchell Hashimoto fe8922dc13 Merge pull request #8567 from premist/resource-fastly-error-msg
provider/fastly: Change error text on findService
2016-08-31 10:40:46 -07:00
Anthony Stanton e4af2d56f2
fixup! Support for Librato Alerts and Services 2016-08-31 17:44:09 +02:00
Anthony Stanton 2b2920ba80
fixup! Support for Librato Alerts and Services 2016-08-31 17:26:39 +02:00
Anthony Stanton 4b2e11ac63
fixup! Support for Librato Alerts and Services 2016-08-31 17:20:08 +02:00
Anthony Stanton 783b2e5780
fixup! Support for Librato Alerts and Services 2016-08-31 17:19:53 +02:00
clint shryock 3580ae03be provider/aws: Randomize some IAM user names to avoid conflicts in tests 2016-08-31 09:33:56 -05:00
Anthony Stanton 2ba1c4e39a
fixup! Support for Librato Alerts and Services 2016-08-31 14:10:37 +02:00
Paul Stack 4d080020ed Merge pull request #8571 from wowgroup/GH-8570
Fix breakage caused by MySQL version string parsing introduced in GH-8251
2016-08-31 12:57:39 +01:00
Paul Stack 85e6323e7b Merge pull request #8574 from hashicorp/fix-spotfleet-tests
provider/aws: `aws_spot_fleet_request` was leaving orphaned instances running
2016-08-31 12:30:46 +01:00
stack72 4d2b9cb167
provider/aws: `aws_spot_fleet_request` was leaving orphaned instances
running

Each nightly build was leaving multiple instances running. The issue is
that the IAM role we were using didn't have access to Terminate the EC2
instances

The role was missing the ec2 principle
2016-08-31 11:25:08 +01:00
protomouse b578b60b88 use hashicorp/go-version to parse mysql server version 2016-08-31 10:50:08 +02:00
Minku Lee 59ff858c16 provider/fastly: Change error text on findService 2016-08-31 12:53:56 +09:00
stack72 750ce1dce6
provider/triton: Id trying to be used before being set
```
Before
=== RUN   TestAccTritonKey_basic
--- FAIL: TestAccTritonKey_basic (1.60s)
       	testing.go:265: Step 0 error: Error applying: 1 error(s) occurred:

       		* triton_key.test: failed to get key with name:
       		caused by: failed unmarshaling/decoding the response body: [{"name":"phinze","fingerprint":"ee:5e:f8:bb:67:a6:60:21:36:5c:73:ce:c6:8b:4d:69","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC/zeXD4lIgk7Pm5r8qIM+U9qBHQE8a9aUXCsQd++SlA/hnBXeOLUpSm9vtuGFkknA1A4oQBvp07ngTFUw4y2ZD8GAIimmKywEetc/f2nnAkzxhbQ9C1OX5U1FbGUv+p8u60nB8ZZ/a4SgKA3IloVQ7HXjQmZKOsutE+IrT5FTviHrp6f7bwIhMkZXAuHWmkHlaIYub0TIgvbXujk6bqTGQq+G1yAeOLm2KSv6oU0v1A0aFYKBmcMVdj587fR0D91+DwsUBpmGeGyMBlA7x7eKFCS7Xme9sb9TC4VvkDg1xNIwZHo1ybkFih+l9DBMR7sbgfzeE6AwDxwY3/do7Uqwv phinze"},{"name":"jen20","fingerprint":"1b:bc:29:48:89:af:72:63:f0:83:b8:11:b6:4d:ff:3f","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6f/7h11O0R4nHY4T9Xd4z2GCN9dPVQYZFvHLbQjwoxIiXYkqy0RVAJlmB9vFuCyxMfS2Hvn9NVhDOQhlXnc1poRaSp98t0uAfFtKfqfGHt5vGrLrA9ACAkPTx5STEryp5/wV9aElcGje4sU2XeFIr0Rf6FPptxGLqXw44yq0X5DVcFg+axov123ErOIMSLNJ7TMdZCh3bqbpE7MnwyBEh69WUwjMr1OfW1AlX0O3RnIHa6HkLCoYnjj4pa3eDKeG0NjAOjbDSqxg8hLVb/+2YA7oaOhZzqhSLmKOZrnFgMSGv90rBbhHzCYTTHNP4NvSGTjPbYzUB/6I6M9l7QD5T James@jn-mpb13"},{"name":"stack72","fingerprint":"40:b3:59:04:7e:e0:08💿08:70:7e:a5:9c:07:22:4d","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGgEagvBiKCc68r2kw7EKyosZs+ibMAQU4as+zOgTFbpHR6iSshAbRUjXXGuSVMmy5GhepnBHdT68hBXD5ny2NcyQPMV2RjSTtzFFWUoazwpUdZiFf4G+fEfK6mLjla1TtHcetCqyjuc1N5+CMWiGypQLDXPtfJKAgNU0RiwXP1SK4zDA8JIl5CcTGtE4ok+mtFFXRIQAoVyAo0u6XM8uToTq/7zH1NKe12pPgcaTthNeZBUiNTaq+BJuS2Y/ws72a7fUsXD5Cc9kvAZQe/QKmMWHOkw8qW8cSDQoWfH2awneZnxNrt3HKPye5IJqbPWhQlpAH32kwvT6DJ0ZAEkZr triton"},{"name":"Acceptance Tests","fingerprint":"b5:28:91:3a:3b:0b:34:72:d4:a6:95:62:40:20:f4:1c","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSbVS0L6gCEfrpguFuNrsRls6cX12khHRVqoipL//UbvdVk1YaJuxHqfHoa+wf+ICTqOqrdxmLXk4VnFuEdECKkNzbNwa0P0QAVC1RLVEv1WHlOf5cFn+imJHt2bis3nHGz4kat1ZAMiKcDYTWGOH4Hn0HS32kW4oVqhINeeifb0uPkBej7YfD0Cs2Ihk5siZ4A2eejlZpw+X7tV9UnDBf4i/3bEnp4owPdSZjfyEJ1KJD1GiFYp3xf+pDEn9hLYOLmUFH2U3+bY+LglILzCRdXKQH5R2qAP5EGVprl5W3QmFlUpoYxGERB1feJZKGqCFQzNZzfvuSHkhxxXdVlOSX James@jn-mpb13"},{"name":"acctest-1882518303167625406","fingerprint":"af:ee:3c:aa:94:e1:08:93:f8:c0:9f:67:62:e5:e7:e9","key":"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDL18KJIe8N7FxcgOMtabo10qZEDyYUSlOpsh/EYrugQCQHMKuNytog1lhFNZNk4LGNAz5L8/btG9+/axY/PfundbjR3SXt0hupAGQIVHuygWTr7foj5iGhckrEM+r3eMCXqoCnIFLhDZLDcq/zN2MxNbqDKcWSYmc8ul9dZWuiQpKOL+0nNXjhYA8Ewu+07kVAtsZD0WfvnAUjxmYb3rB15eBWk7gLxHrOPfZpeDSvOOX2bmzikpLn+L5NKrJsLrzO6hU/rpxD4OTHLULcsnIts3lYH8hShU8uY5ry94PBzdix++se3pUGvNSe967fKlHw3Ymh9nE/LJDQnzTNyFMj James@jn-mpb13"}]
       		caused by: unexpected type *cloudapi.Key
```

```
After
=== RUN   TestAccTritonKey_basic
--- PASS: TestAccTritonKey_basic (17.14s)
```
2016-08-30 23:19:04 +01:00
Krzysztof Wilczynski 6a94f920e1 provider/aws: Handle missing EFS mount target in aws_efs_mount_target. (#8529)
* Handle missing EFS mount target in aws_efs_mount_target.

This commit resolves issue where the EFS mount target would be already
deleted (e.g. it was deleted outside of Terraform, etc.). Also, correct
how values are begin set in the ReadFunc to avoid nil pointer dereference.

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

* Add EFS mount target DNS helper function.

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

* Add EFS mount target response helper.

This commit adds a helper which can be used to check whether the response
contains a valid and non-empty list of EFS file system mount targets.

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

* Add acceptance test to check for non-empty plan.

This commit adds a test to verify the condition where the underlying EFS mount
target would be deleted and/or disappear resulting in a new resource to be
created to replace it.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
2016-08-30 10:42:54 +01:00
Richard Bowden b673f4d972 adds resource retry to SpotInstanceRequestCreate (#8516)
so that the create process waits for IAM Instance profiles and roles to propagate before continuing, this has been taken from `resource_aws_instance`
2016-08-29 21:53:40 +01:00
Kurt Scherer a4fd7ce23b provider/datadog: Govendor update dependencies (#8428)
* Includes bugfixes in zorkian/go-datadog-api
* Struct changes upstream required small changes to provider code
2016-08-29 21:30:31 +01:00
stack72 7fe49999fb
Merge branch '7721-enable-disable-access-logs' of https://github.com/optimisticanshul/terraform into optimisticanshul-7721-enable-disable-access-logs 2016-08-29 21:00:46 +01:00
Radek Simko cc38378870 provider/aws: API Gateway Custom Authorizer (#8535)
* [WIP] AWS APIGateway Custom Authorizer

* provider/aws: api_gateway_method - Add missing fields to Read+Update

* provider/aws: Make API Gateway name in test more specific

* provider/aws: APIG - Use minimal configuration in create request
2016-08-29 20:51:59 +01:00
Radek Simko 8317fe73d4 provider/aws: Add AWS error message to retry APIGateway acc update on (#8533) 2016-08-29 20:02:15 +01:00
stack72 517f0f8477
Merge branch 'statuscake-contactgroup' of https://github.com/tape-tv/terraform into tape-tv-statuscake-contactgroup 2016-08-28 23:49:57 +01:00
Radek Simko 302982c335 provider/aws: Remove unsafe ptr dereferencing [A-C]* (#8519) 2016-08-28 19:25:30 +01:00
Radek Simko 2223964ff1 provider/aws: Remove unsafe ptr dereferencing from ECS/ECR (#8514) 2016-08-28 17:15:45 +01:00
Radek Simko 1c12ead951 provider/github: Remove unsafe ptr dereferencing (#8512) 2016-08-28 17:15:03 +01:00
Radek Simko ed39b8634f provider/aws: Remove unsafe ptr dereferencing from ami data source (#8513) 2016-08-28 15:39:40 +01:00
Carlos Sanchez bb5c83ca49 provider/aws: Increase route_table timeouts (#8465) 2016-08-27 21:32:55 +01:00
Martin Atkins 4f906dba7a Merge #8403: name_regex attribute on aws_ami data source 2016-08-27 13:11:45 -07:00
Alex Eftimie 3a97971e41 Refactor for code simplicity. 2016-08-27 12:54:42 -07:00
Alex Eftimie d44ae5028f S3Bucket and S3Key are always required 2016-08-27 12:54:41 -07:00
Alex Eftimie c9bd7d680f Add a test to check the unversioned lambda function update - copy and adapt genAWSLambdaFunctionConfig_s3 2016-08-27 12:54:41 -07:00
Alex Eftimie c5f788ec58 Attempt to fix #6794 - update only non empty fields on aws_lambda_function s3 2016-08-27 12:54:41 -07:00
Clint daac877c82 provider/aws: Get and export ASG ARN value (#8503) 2016-08-27 15:20:11 +01:00
Paul Stack 6062d592df provider/google: Change Compute VPN Tunnel test to use the correct port range (#8504) 2016-08-27 00:51:57 +01:00
Paul Stack 6ea53e5e3c provider/aws: Refresh `aws_route` from state if `aws_route_table` not (#8443)
found

Fixes #5288
Fixes #8388

```
TESTS TBC
```
2016-08-26 07:50:14 +01:00
Radek Simko 0dd17c646b provider/aws: Cleanup the Lambda ENI deletion process a bit (#8486) 2016-08-26 07:30:47 +01:00
Mitchell Hashimoto 6b124a4760 Merge pull request #8479 from dtolnay/detach
provider/aws: Propagate errors from DetachVolume
2016-08-25 22:21:46 -07:00
Glenn Poston 19426109da Lambda ENI cleanup added to security group delete (#8033) 2016-08-25 23:08:19 +01: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
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