terraform/builtin/providers/aws/resource_aws_opsworks_rds_d...

203 lines
5.2 KiB
Go
Raw Normal View History

package aws
import (
"fmt"
"log"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/service/opsworks"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
)
func resourceAwsOpsworksRdsDbInstance() *schema.Resource {
return &schema.Resource{
Create: resourceAwsOpsworksRdsDbInstanceRegister,
Update: resourceAwsOpsworksRdsDbInstanceUpdate,
Delete: resourceAwsOpsworksRdsDbInstanceDeregister,
Read: resourceAwsOpsworksRdsDbInstanceRead,
Schema: map[string]*schema.Schema{
provider/aws: Remove restriction on running aws_opsworks_* on us-east-1 (#12688) Fixes: #11824 A full set of acceptance tests for *all* OpsWorks tests are below. There is a single issue, opsworks_instance isn't ordering the layer_ids so it's non-deterministic which can come back. This introduces a false positive. The opsworks tests are running both against us-east-1 for some and us-west-2 for others. This must be marked as a backwards incompatibility in 0.9 just incase people are using the opsworks region parameter to try and override the provider region ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksApplication' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:11:36 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksApplication -timeout 120m === RUN TestAccAWSOpsworksApplication --- PASS: TestAccAWSOpsworksApplication (164.29s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 164.319s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksCustomLayer' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:16:18 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksCustomLayer -timeout 120m === RUN TestAccAWSOpsworksCustomLayerImportBasic --- PASS: TestAccAWSOpsworksCustomLayerImportBasic (105.98s) === RUN TestAccAWSOpsworksCustomLayer --- PASS: TestAccAWSOpsworksCustomLayer (92.68s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 198.684s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksPermission' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:23:28 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksPermission -timeout 120m === RUN TestAccAWSOpsworksPermission --- PASS: TestAccAWSOpsworksPermission (226.36s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 226.386s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksRailsAppLayer' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:28:01 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksRailsAppLayer -timeout 120m === RUN TestAccAWSOpsworksRailsAppLayer --- PASS: TestAccAWSOpsworksRailsAppLayer (129.39s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 129.426s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksUserProfile' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:37:46 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksUserProfile -timeout 120m === RUN TestAccAWSOpsworksUserProfile --- PASS: TestAccAWSOpsworksUserProfile (42.60s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 42.624s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksStack' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 18:00:50 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksStack -timeout 120m === RUN TestAccAWSOpsworksStackImportBasic --- PASS: TestAccAWSOpsworksStackImportBasic (50.28s) === RUN TestAccAWSOpsworksStackNoVpc --- PASS: TestAccAWSOpsworksStackNoVpc (25.92s) === RUN TestAccAWSOpsworksStackVpc --- PASS: TestAccAWSOpsworksStackVpc (76.80s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 153.025s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksRdsDbInstance' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:38:36 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksRdsDbInstance -timeout 120m === RUN TestAccAWSOpsworksRdsDbInstance --- PASS: TestAccAWSOpsworksRdsDbInstance (916.15s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 916.177s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksInstance' 2 ↵ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:26:45 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksInstance -timeout 120m === RUN TestAccAWSOpsworksInstance_importBasic --- PASS: TestAccAWSOpsworksInstance_importBasic (85.52s) === RUN TestAccAWSOpsworksInstance --- FAIL: TestAccAWSOpsworksInstance (114.09s) testing.go:268: Step 1 error: After applying this step, the plan was not empty: DIFF: UPDATE: aws_opsworks_instance.tf-acc layer_ids.0: "4c29b76f-df72-409e-a5c4-9459b7d9b4a4" => "a4a859cf-2a07-447e-a151-a97a6d827db7" layer_ids.1: "a4a859cf-2a07-447e-a151-a97a6d827db7" => "4c29b76f-df72-409e-a5c4-9459b7d9b4a4" FAIL exit status 1 FAIL github.com/hashicorp/terraform/builtin/providers/aws 199.643s make: *** [testacc] Error 1 ```
2017-03-15 15:17:53 +01:00
"id": {
Type: schema.TypeString,
Computed: true,
},
provider/aws: Remove restriction on running aws_opsworks_* on us-east-1 (#12688) Fixes: #11824 A full set of acceptance tests for *all* OpsWorks tests are below. There is a single issue, opsworks_instance isn't ordering the layer_ids so it's non-deterministic which can come back. This introduces a false positive. The opsworks tests are running both against us-east-1 for some and us-west-2 for others. This must be marked as a backwards incompatibility in 0.9 just incase people are using the opsworks region parameter to try and override the provider region ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksApplication' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:11:36 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksApplication -timeout 120m === RUN TestAccAWSOpsworksApplication --- PASS: TestAccAWSOpsworksApplication (164.29s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 164.319s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksCustomLayer' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:16:18 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksCustomLayer -timeout 120m === RUN TestAccAWSOpsworksCustomLayerImportBasic --- PASS: TestAccAWSOpsworksCustomLayerImportBasic (105.98s) === RUN TestAccAWSOpsworksCustomLayer --- PASS: TestAccAWSOpsworksCustomLayer (92.68s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 198.684s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksPermission' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:23:28 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksPermission -timeout 120m === RUN TestAccAWSOpsworksPermission --- PASS: TestAccAWSOpsworksPermission (226.36s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 226.386s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksRailsAppLayer' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:28:01 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksRailsAppLayer -timeout 120m === RUN TestAccAWSOpsworksRailsAppLayer --- PASS: TestAccAWSOpsworksRailsAppLayer (129.39s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 129.426s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksUserProfile' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:37:46 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksUserProfile -timeout 120m === RUN TestAccAWSOpsworksUserProfile --- PASS: TestAccAWSOpsworksUserProfile (42.60s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 42.624s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksStack' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 18:00:50 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksStack -timeout 120m === RUN TestAccAWSOpsworksStackImportBasic --- PASS: TestAccAWSOpsworksStackImportBasic (50.28s) === RUN TestAccAWSOpsworksStackNoVpc --- PASS: TestAccAWSOpsworksStackNoVpc (25.92s) === RUN TestAccAWSOpsworksStackVpc --- PASS: TestAccAWSOpsworksStackVpc (76.80s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 153.025s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksRdsDbInstance' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:38:36 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksRdsDbInstance -timeout 120m === RUN TestAccAWSOpsworksRdsDbInstance --- PASS: TestAccAWSOpsworksRdsDbInstance (916.15s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 916.177s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksInstance' 2 ↵ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:26:45 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksInstance -timeout 120m === RUN TestAccAWSOpsworksInstance_importBasic --- PASS: TestAccAWSOpsworksInstance_importBasic (85.52s) === RUN TestAccAWSOpsworksInstance --- FAIL: TestAccAWSOpsworksInstance (114.09s) testing.go:268: Step 1 error: After applying this step, the plan was not empty: DIFF: UPDATE: aws_opsworks_instance.tf-acc layer_ids.0: "4c29b76f-df72-409e-a5c4-9459b7d9b4a4" => "a4a859cf-2a07-447e-a151-a97a6d827db7" layer_ids.1: "a4a859cf-2a07-447e-a151-a97a6d827db7" => "4c29b76f-df72-409e-a5c4-9459b7d9b4a4" FAIL exit status 1 FAIL github.com/hashicorp/terraform/builtin/providers/aws 199.643s make: *** [testacc] Error 1 ```
2017-03-15 15:17:53 +01:00
"stack_id": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
provider/aws: Remove restriction on running aws_opsworks_* on us-east-1 (#12688) Fixes: #11824 A full set of acceptance tests for *all* OpsWorks tests are below. There is a single issue, opsworks_instance isn't ordering the layer_ids so it's non-deterministic which can come back. This introduces a false positive. The opsworks tests are running both against us-east-1 for some and us-west-2 for others. This must be marked as a backwards incompatibility in 0.9 just incase people are using the opsworks region parameter to try and override the provider region ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksApplication' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:11:36 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksApplication -timeout 120m === RUN TestAccAWSOpsworksApplication --- PASS: TestAccAWSOpsworksApplication (164.29s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 164.319s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksCustomLayer' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:16:18 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksCustomLayer -timeout 120m === RUN TestAccAWSOpsworksCustomLayerImportBasic --- PASS: TestAccAWSOpsworksCustomLayerImportBasic (105.98s) === RUN TestAccAWSOpsworksCustomLayer --- PASS: TestAccAWSOpsworksCustomLayer (92.68s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 198.684s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksPermission' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:23:28 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksPermission -timeout 120m === RUN TestAccAWSOpsworksPermission --- PASS: TestAccAWSOpsworksPermission (226.36s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 226.386s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksRailsAppLayer' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:28:01 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksRailsAppLayer -timeout 120m === RUN TestAccAWSOpsworksRailsAppLayer --- PASS: TestAccAWSOpsworksRailsAppLayer (129.39s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 129.426s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksUserProfile' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:37:46 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksUserProfile -timeout 120m === RUN TestAccAWSOpsworksUserProfile --- PASS: TestAccAWSOpsworksUserProfile (42.60s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 42.624s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksStack' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 18:00:50 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksStack -timeout 120m === RUN TestAccAWSOpsworksStackImportBasic --- PASS: TestAccAWSOpsworksStackImportBasic (50.28s) === RUN TestAccAWSOpsworksStackNoVpc --- PASS: TestAccAWSOpsworksStackNoVpc (25.92s) === RUN TestAccAWSOpsworksStackVpc --- PASS: TestAccAWSOpsworksStackVpc (76.80s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 153.025s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksRdsDbInstance' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:38:36 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksRdsDbInstance -timeout 120m === RUN TestAccAWSOpsworksRdsDbInstance --- PASS: TestAccAWSOpsworksRdsDbInstance (916.15s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 916.177s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksInstance' 2 ↵ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:26:45 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksInstance -timeout 120m === RUN TestAccAWSOpsworksInstance_importBasic --- PASS: TestAccAWSOpsworksInstance_importBasic (85.52s) === RUN TestAccAWSOpsworksInstance --- FAIL: TestAccAWSOpsworksInstance (114.09s) testing.go:268: Step 1 error: After applying this step, the plan was not empty: DIFF: UPDATE: aws_opsworks_instance.tf-acc layer_ids.0: "4c29b76f-df72-409e-a5c4-9459b7d9b4a4" => "a4a859cf-2a07-447e-a151-a97a6d827db7" layer_ids.1: "a4a859cf-2a07-447e-a151-a97a6d827db7" => "4c29b76f-df72-409e-a5c4-9459b7d9b4a4" FAIL exit status 1 FAIL github.com/hashicorp/terraform/builtin/providers/aws 199.643s make: *** [testacc] Error 1 ```
2017-03-15 15:17:53 +01:00
"rds_db_instance_arn": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
provider/aws: Remove restriction on running aws_opsworks_* on us-east-1 (#12688) Fixes: #11824 A full set of acceptance tests for *all* OpsWorks tests are below. There is a single issue, opsworks_instance isn't ordering the layer_ids so it's non-deterministic which can come back. This introduces a false positive. The opsworks tests are running both against us-east-1 for some and us-west-2 for others. This must be marked as a backwards incompatibility in 0.9 just incase people are using the opsworks region parameter to try and override the provider region ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksApplication' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:11:36 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksApplication -timeout 120m === RUN TestAccAWSOpsworksApplication --- PASS: TestAccAWSOpsworksApplication (164.29s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 164.319s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksCustomLayer' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:16:18 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksCustomLayer -timeout 120m === RUN TestAccAWSOpsworksCustomLayerImportBasic --- PASS: TestAccAWSOpsworksCustomLayerImportBasic (105.98s) === RUN TestAccAWSOpsworksCustomLayer --- PASS: TestAccAWSOpsworksCustomLayer (92.68s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 198.684s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksPermission' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:23:28 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksPermission -timeout 120m === RUN TestAccAWSOpsworksPermission --- PASS: TestAccAWSOpsworksPermission (226.36s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 226.386s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksRailsAppLayer' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:28:01 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksRailsAppLayer -timeout 120m === RUN TestAccAWSOpsworksRailsAppLayer --- PASS: TestAccAWSOpsworksRailsAppLayer (129.39s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 129.426s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksUserProfile' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:37:46 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksUserProfile -timeout 120m === RUN TestAccAWSOpsworksUserProfile --- PASS: TestAccAWSOpsworksUserProfile (42.60s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 42.624s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksStack' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 18:00:50 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksStack -timeout 120m === RUN TestAccAWSOpsworksStackImportBasic --- PASS: TestAccAWSOpsworksStackImportBasic (50.28s) === RUN TestAccAWSOpsworksStackNoVpc --- PASS: TestAccAWSOpsworksStackNoVpc (25.92s) === RUN TestAccAWSOpsworksStackVpc --- PASS: TestAccAWSOpsworksStackVpc (76.80s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 153.025s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksRdsDbInstance' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:38:36 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksRdsDbInstance -timeout 120m === RUN TestAccAWSOpsworksRdsDbInstance --- PASS: TestAccAWSOpsworksRdsDbInstance (916.15s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 916.177s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksInstance' 2 ↵ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:26:45 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksInstance -timeout 120m === RUN TestAccAWSOpsworksInstance_importBasic --- PASS: TestAccAWSOpsworksInstance_importBasic (85.52s) === RUN TestAccAWSOpsworksInstance --- FAIL: TestAccAWSOpsworksInstance (114.09s) testing.go:268: Step 1 error: After applying this step, the plan was not empty: DIFF: UPDATE: aws_opsworks_instance.tf-acc layer_ids.0: "4c29b76f-df72-409e-a5c4-9459b7d9b4a4" => "a4a859cf-2a07-447e-a151-a97a6d827db7" layer_ids.1: "a4a859cf-2a07-447e-a151-a97a6d827db7" => "4c29b76f-df72-409e-a5c4-9459b7d9b4a4" FAIL exit status 1 FAIL github.com/hashicorp/terraform/builtin/providers/aws 199.643s make: *** [testacc] Error 1 ```
2017-03-15 15:17:53 +01:00
"db_password": {
Type: schema.TypeString,
Required: true,
Sensitive: true,
},
provider/aws: Remove restriction on running aws_opsworks_* on us-east-1 (#12688) Fixes: #11824 A full set of acceptance tests for *all* OpsWorks tests are below. There is a single issue, opsworks_instance isn't ordering the layer_ids so it's non-deterministic which can come back. This introduces a false positive. The opsworks tests are running both against us-east-1 for some and us-west-2 for others. This must be marked as a backwards incompatibility in 0.9 just incase people are using the opsworks region parameter to try and override the provider region ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksApplication' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:11:36 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksApplication -timeout 120m === RUN TestAccAWSOpsworksApplication --- PASS: TestAccAWSOpsworksApplication (164.29s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 164.319s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksCustomLayer' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:16:18 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksCustomLayer -timeout 120m === RUN TestAccAWSOpsworksCustomLayerImportBasic --- PASS: TestAccAWSOpsworksCustomLayerImportBasic (105.98s) === RUN TestAccAWSOpsworksCustomLayer --- PASS: TestAccAWSOpsworksCustomLayer (92.68s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 198.684s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksPermission' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:23:28 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksPermission -timeout 120m === RUN TestAccAWSOpsworksPermission --- PASS: TestAccAWSOpsworksPermission (226.36s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 226.386s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksRailsAppLayer' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:28:01 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksRailsAppLayer -timeout 120m === RUN TestAccAWSOpsworksRailsAppLayer --- PASS: TestAccAWSOpsworksRailsAppLayer (129.39s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 129.426s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksUserProfile' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:37:46 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksUserProfile -timeout 120m === RUN TestAccAWSOpsworksUserProfile --- PASS: TestAccAWSOpsworksUserProfile (42.60s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 42.624s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksStack' 2 ↵ ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 18:00:50 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksStack -timeout 120m === RUN TestAccAWSOpsworksStackImportBasic --- PASS: TestAccAWSOpsworksStackImportBasic (50.28s) === RUN TestAccAWSOpsworksStackNoVpc --- PASS: TestAccAWSOpsworksStackNoVpc (25.92s) === RUN TestAccAWSOpsworksStackVpc --- PASS: TestAccAWSOpsworksStackVpc (76.80s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 153.025s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksRdsDbInstance' ✹ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:38:36 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksRdsDbInstance -timeout 120m === RUN TestAccAWSOpsworksRdsDbInstance --- PASS: TestAccAWSOpsworksRdsDbInstance (916.15s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 916.177s ``` ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksInstance' 2 ↵ ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/03/14 17:26:45 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSOpsworksInstance -timeout 120m === RUN TestAccAWSOpsworksInstance_importBasic --- PASS: TestAccAWSOpsworksInstance_importBasic (85.52s) === RUN TestAccAWSOpsworksInstance --- FAIL: TestAccAWSOpsworksInstance (114.09s) testing.go:268: Step 1 error: After applying this step, the plan was not empty: DIFF: UPDATE: aws_opsworks_instance.tf-acc layer_ids.0: "4c29b76f-df72-409e-a5c4-9459b7d9b4a4" => "a4a859cf-2a07-447e-a151-a97a6d827db7" layer_ids.1: "a4a859cf-2a07-447e-a151-a97a6d827db7" => "4c29b76f-df72-409e-a5c4-9459b7d9b4a4" FAIL exit status 1 FAIL github.com/hashicorp/terraform/builtin/providers/aws 199.643s make: *** [testacc] Error 1 ```
2017-03-15 15:17:53 +01:00
"db_user": {
Type: schema.TypeString,
Required: true,
},
},
}
}
func resourceAwsOpsworksRdsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*AWSClient).opsworksconn
d.Partial(true)
d.SetPartial("rds_db_instance_arn")
req := &opsworks.UpdateRdsDbInstanceInput{
RdsDbInstanceArn: aws.String(d.Get("rds_db_instance_arn").(string)),
}
requestUpdate := false
if d.HasChange("db_user") {
d.SetPartial("db_user")
req.DbUser = aws.String(d.Get("db_user").(string))
requestUpdate = true
}
if d.HasChange("db_password") {
d.SetPartial("db_password")
req.DbPassword = aws.String(d.Get("db_password").(string))
requestUpdate = true
}
if true == requestUpdate {
log.Printf("[DEBUG] Opsworks RDS DB Instance Modification request: %s", req)
err := resource.Retry(2*time.Minute, func() *resource.RetryError {
var cerr error
_, cerr = client.UpdateRdsDbInstance(req)
if cerr != nil {
log.Printf("[INFO] client error")
if opserr, ok := cerr.(awserr.Error); ok {
log.Printf("[ERROR] OpsWorks error: %s message: %s", opserr.Code(), opserr.Message())
}
return resource.NonRetryableError(cerr)
}
return nil
})
if err != nil {
return err
}
}
d.Partial(false)
return resourceAwsOpsworksRdsDbInstanceRead(d, meta)
}
func resourceAwsOpsworksRdsDbInstanceDeregister(d *schema.ResourceData, meta interface{}) error {
client := meta.(*AWSClient).opsworksconn
req := &opsworks.DeregisterRdsDbInstanceInput{
RdsDbInstanceArn: aws.String(d.Get("rds_db_instance_arn").(string)),
}
log.Printf("[DEBUG] Unregistering rds db instance '%s' from stack: %s", d.Get("rds_db_instance_arn"), d.Get("stack_id"))
err := resource.Retry(2*time.Minute, func() *resource.RetryError {
var cerr error
_, cerr = client.DeregisterRdsDbInstance(req)
if cerr != nil {
log.Printf("[INFO] client error")
if opserr, ok := cerr.(awserr.Error); ok {
if opserr.Code() == "ResourceNotFoundException" {
log.Printf("[INFO] The db instance could not be found. Remove it from state.")
d.SetId("")
return nil
}
log.Printf("[ERROR] OpsWorks error: %s message: %s", opserr.Code(), opserr.Message())
}
return resource.NonRetryableError(cerr)
}
return nil
})
if err != nil {
return err
}
return nil
}
func resourceAwsOpsworksRdsDbInstanceRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*AWSClient).opsworksconn
req := &opsworks.DescribeRdsDbInstancesInput{
StackId: aws.String(d.Get("stack_id").(string)),
}
log.Printf("[DEBUG] Reading OpsWorks registerd rds db instances for stack: %s", d.Get("stack_id"))
resp, err := client.DescribeRdsDbInstances(req)
if err != nil {
return err
}
found := false
id := ""
for _, instance := range resp.RdsDbInstances {
id = fmt.Sprintf("%s%s", *instance.RdsDbInstanceArn, *instance.StackId)
if fmt.Sprintf("%s%s", d.Get("rds_db_instance_arn").(string), d.Get("stack_id").(string)) == id {
found = true
d.SetId(id)
d.Set("id", id)
d.Set("stack_id", instance.StackId)
d.Set("rds_db_instance_arn", instance.RdsDbInstanceArn)
d.Set("db_user", instance.DbUser)
}
}
if false == found {
d.SetId("")
log.Printf("[INFO] The rds instance '%s' could not be found for stack: '%s'", d.Get("rds_db_instance_arn"), d.Get("stack_id"))
}
return nil
}
func resourceAwsOpsworksRdsDbInstanceRegister(d *schema.ResourceData, meta interface{}) error {
client := meta.(*AWSClient).opsworksconn
req := &opsworks.RegisterRdsDbInstanceInput{
StackId: aws.String(d.Get("stack_id").(string)),
RdsDbInstanceArn: aws.String(d.Get("rds_db_instance_arn").(string)),
DbUser: aws.String(d.Get("db_user").(string)),
DbPassword: aws.String(d.Get("db_password").(string)),
}
err := resource.Retry(2*time.Minute, func() *resource.RetryError {
var cerr error
_, cerr = client.RegisterRdsDbInstance(req)
if cerr != nil {
log.Printf("[INFO] client error")
if opserr, ok := cerr.(awserr.Error); ok {
log.Printf("[ERROR] OpsWorks error: %s message: %s", opserr.Code(), opserr.Message())
}
return resource.NonRetryableError(cerr)
}
return nil
})
if err != nil {
return err
}
return resourceAwsOpsworksRdsDbInstanceRead(d, meta)
}