Skip to content

Commit

Permalink
provider/aws: Wait for aws_opsworks_instance to be running when it's …
Browse files Browse the repository at this point in the history
…specified (#13218)

Fixes: #9959

When we specify that we want an opsworks_instance state of running, we
should wait for that the be the case. This will then allow us to use the
Computed values (e.g. private_ip) etc and allow us to use provisioners
as part of the terraform config

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSOpsworksInstance'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/03/30 20:55:21 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 (72.28s)
=== RUN   TestAccAWSOpsworksInstance
--- PASS: TestAccAWSOpsworksInstance (110.17s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	182.479s
```
  • Loading branch information
stack72 authored Mar 31, 2017
1 parent b449b80 commit 74c0353
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions builtin/providers/aws/resource_aws_opsworks_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ func resourceAwsOpsworksInstanceCreate(d *schema.ResourceData, meta interface{})
d.Set("id", instanceId)

if v, ok := d.GetOk("state"); ok && v.(string) == "running" {
err := startOpsworksInstance(d, meta, false)
err := startOpsworksInstance(d, meta, true)
if err != nil {
return err
}
Expand Down Expand Up @@ -860,7 +860,7 @@ func resourceAwsOpsworksInstanceUpdate(d *schema.ResourceData, meta interface{})
}
} else {
if status != "stopped" && status != "stopping" && status != "shutting_down" {
err := stopOpsworksInstance(d, meta, false)
err := stopOpsworksInstance(d, meta, true)
if err != nil {
return err
}
Expand Down

0 comments on commit 74c0353

Please sign in to comment.