forked from hashicorp/terraform-provider-aws
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
r/aws_globalaccelerator_accelerator: Use internal finder package. Add…
… '_disappears' test (hashicorp#13826, hashicorp#13527). Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAwsGlobalAcceleratorAccelerator_' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsGlobalAcceleratorAccelerator_ -timeout 120m === RUN TestAccAwsGlobalAcceleratorAccelerator_basic === PAUSE TestAccAwsGlobalAcceleratorAccelerator_basic === RUN TestAccAwsGlobalAcceleratorAccelerator_disappears === PAUSE TestAccAwsGlobalAcceleratorAccelerator_disappears === RUN TestAccAwsGlobalAcceleratorAccelerator_update === PAUSE TestAccAwsGlobalAcceleratorAccelerator_update === RUN TestAccAwsGlobalAcceleratorAccelerator_attributes === PAUSE TestAccAwsGlobalAcceleratorAccelerator_attributes === RUN TestAccAwsGlobalAcceleratorAccelerator_tags === PAUSE TestAccAwsGlobalAcceleratorAccelerator_tags === CONT TestAccAwsGlobalAcceleratorAccelerator_basic === CONT TestAccAwsGlobalAcceleratorAccelerator_attributes === CONT TestAccAwsGlobalAcceleratorAccelerator_tags === CONT TestAccAwsGlobalAcceleratorAccelerator_update === CONT TestAccAwsGlobalAcceleratorAccelerator_disappears --- PASS: TestAccAwsGlobalAcceleratorAccelerator_disappears (68.53s) --- PASS: TestAccAwsGlobalAcceleratorAccelerator_basic (77.55s) --- PASS: TestAccAwsGlobalAcceleratorAccelerator_tags (101.99s) --- PASS: TestAccAwsGlobalAcceleratorAccelerator_update (103.04s) --- PASS: TestAccAwsGlobalAcceleratorAccelerator_attributes (112.32s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 112.414s
- Loading branch information
Showing
5 changed files
with
295 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package waiter | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/service/globalaccelerator" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
"github.com/terraform-providers/terraform-provider-aws/aws/internal/service/globalaccelerator/finder" | ||
"github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource" | ||
) | ||
|
||
// AcceleratorStatus fetches the Accelerator and its Status | ||
func AcceleratorStatus(conn *globalaccelerator.GlobalAccelerator, arn string) resource.StateRefreshFunc { | ||
return func() (interface{}, string, error) { | ||
accelerator, err := finder.AcceleratorByARN(conn, arn) | ||
|
||
if tfresource.NotFound(err) { | ||
return nil, "", nil | ||
} | ||
|
||
if err != nil { | ||
return nil, "", err | ||
} | ||
|
||
return accelerator, aws.StringValue(accelerator.Status), nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package waiter | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/aws/aws-sdk-go/service/globalaccelerator" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
// AcceleratorDeployed waits for an Accelerator to return Deployed | ||
func AcceleratorDeployed(conn *globalaccelerator.GlobalAccelerator, arn string, timeout time.Duration) (*globalaccelerator.Accelerator, error) { | ||
stateConf := &resource.StateChangeConf{ | ||
Pending: []string{globalaccelerator.AcceleratorStatusInProgress}, | ||
Target: []string{globalaccelerator.AcceleratorStatusDeployed}, | ||
Refresh: AcceleratorStatus(conn, arn), | ||
Timeout: timeout, | ||
} | ||
|
||
outputRaw, err := stateConf.WaitForState() | ||
|
||
if v, ok := outputRaw.(*globalaccelerator.Accelerator); ok { | ||
return v, err | ||
} | ||
|
||
return nil, err | ||
} |
Oops, something went wrong.