Commit Graph

18 Commits

Author SHA1 Message Date
Krzysztof Wilczynski 6c27f175b5
Add JSON validation to the aws_sns_topic resource.
This commit adds support for new helper function which is used to
normalise and validate JSON string.

This commit also removes unnecessary code from the StateFunc function,
and reduces it so that it only uses the normalizeJsonString helper.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>
2016-09-22 09:01:15 +01:00
stack72 5504185770
provider/aws: Add DiffSupressionFunc to `aws_elasticsearch_domain`,
`aws_sqs_queue` and `aws_sns_topic`

```
SQS Queue Tests:
%make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSQSQueue'
2 ↵ ✹
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/09/05 09:46:04 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSQSQueue
-timeout 120m
=== RUN   TestAccAWSSQSQueue_importBasic
--- PASS: TestAccAWSSQSQueue_importBasic (18.99s)
=== RUN   TestAccAWSSQSQueue_basic
--- PASS: TestAccAWSSQSQueue_basic (44.31s)
=== RUN   TestAccAWSSQSQueue_policy
--- PASS: TestAccAWSSQSQueue_policy (32.76s)
=== RUN   TestAccAWSSQSQueue_redrivePolicy
--- PASS: TestAccAWSSQSQueue_redrivePolicy (66.42s)
=== RUN   TestAccAWSSQSQueue_Policybasic
--- PASS: TestAccAWSSQSQueue_Policybasic (32.40s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    194.895s
```
SNS Topic Tests:

% make testacc TEST=./builtin/providers/aws
% TESTARGS='-run=TestAccAWSSNSTopic_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2016/09/04 22:56:26 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSNSTopic_
-timeout 120m
=== RUN   TestAccAWSSNSTopic_importBasic
--- PASS: TestAccAWSSNSTopic_importBasic (17.67s)
=== RUN   TestAccAWSSNSTopic_basic
--- PASS: TestAccAWSSNSTopic_basic (17.92s)
=== RUN   TestAccAWSSNSTopic_policy
--- PASS: TestAccAWSSNSTopic_policy (20.99s)
=== RUN   TestAccAWSSNSTopic_withIAMRole
--- PASS: TestAccAWSSNSTopic_withIAMRole (26.51s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    83.112s
```
2016-09-05 11:46:23 +01:00
stack72 b310842383 provider/aws: Support Import for `aws_sns_topic`
```
make testacc TEST=./builtin/providers/aws
TESTARGS='-run=TestAccAWSSNSTopic_'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /vendor/)
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSNSTopic_
-timeout 120m
=== RUN   TestAccAWSSNSTopic_importBasic
--- PASS: TestAccAWSSNSTopic_importBasic (17.02s)
=== RUN   TestAccAWSSNSTopic_basic
--- PASS: TestAccAWSSNSTopic_basic (16.59s)
=== RUN   TestAccAWSSNSTopic_withIAMRole
--- PASS: TestAccAWSSNSTopic_withIAMRole (28.90s)
PASS
ok      github.com/hashicorp/terraform/builtin/providers/aws    62.536s
```
2016-06-23 02:27:13 +01:00
Mitchell Hashimoto 3a43ce8f8e
providers/aws: sns_topic id-only 2016-04-21 08:18:04 -07:00
Hector Rivas Gandara 0fdf91661d provider/aws: normalize json policy for sns topic policy attribute (#6089)
* provider/aws: test empty plan with sns_topic policy with random order

If we setup a sns_topic policy with a policy with a different order
to the one set by the AWS API, terraform plan will be not empty between
runs.

* provider/aws: normalize json policy for sns topic

For the policy attribute of the resource aws_sns_topic,  AWS returns the policy
in JSON format with the fields in a different order.
If we store and compare the values without normalizing, terraform
will unnecesary trigger and update of the resource.

To avoid that, we must add a normalization function in the StateFunc of
the policy attribute and also when we read the attribute from AWS.
2016-04-08 13:55:49 -05:00
Clint b351a72e4c provider/aws: Normalize and compact SQS Redrive, Policy JSON
* provider/aws: Nomralize SQS Redrive Policy JSON

* provider/aws: Fix typo in log statements

* compact the Policy on SNS Queue

* add acceptance test for policy formatting
2016-04-04 11:41:36 -05:00
stack72 91cb65dd05 Provider/aws - SNS Topics deleted from the UI were causing Terraform to
throw an error:

* aws_sns_topic_subscription.checker: NotFound: Subscription does not
* exist
    status code: 404, request id: b8ca0c27-1a62-57b3-8b96-43038a0ead86

Terraform wasn't refreshing the state when the topic gave a 404
2016-01-28 23:26:05 +00: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 shryock 15533dca09 actually use the value 2015-11-06 14:06:50 -06:00
clint shryock 274781224e provider/aws: fix panic with SNS topic policy if omitted 2015-11-05 15:25:04 -06:00
Tomas Doran 87dd5c5bd0 Fix panic I see when upgrading to 0.6.6
Check if the policy is nil or not before type casting it
2015-11-04 04:23:13 -08:00
clint shryock 3f2a0ee743 provider/aws: Refresh SNS Topic updates in event of IAM role failure
- encode the json policy to match what we get back from the API
- retry if the IAM resource isn't yet available
- include regression test
2015-10-30 12:09:44 -05:00
Clint Shryock 0c2f189d08 provider/aws: Update to aws-sdk 0.9.0 rc1 2015-08-17 13:27:16 -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 de141fe1cc provider/aws: Updates to SNS / SQS resources after upstream change 2015-06-03 08:46:03 -05:00
John Ewart 1dd95df5ab Export ARN in SQS queue and SNS topic / subscription; updated tests for new AWS SDK errors; updated documentation. 2015-05-22 21:12:25 -07:00
John Ewart 0196a0c2ae Changed Required: false to Optional: true in the SNS topic schema 2015-05-22 20:26:10 -07:00
John Ewart 68734517f8 Initial SNS support 2015-05-22 20:26:10 -07:00