-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add interconnect attachment state waiting (#2999)
Merged PR #2999.
- Loading branch information
1 parent
29617d8
commit 4e9cbb2
Showing
8 changed files
with
42 additions
and
11 deletions.
There are no files selected for viewing
Submodule terraform
updated
from 986132 to 6f8673
Submodule terraform-beta
updated
from 10c5bc to 8f44f5
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
18 changes: 18 additions & 0 deletions
18
templates/terraform/constants/interconnect_attachment.go.erb
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,18 @@ | ||
// waitForAttachmentToBeProvisioned waits for an attachment to leave the | ||
// "UNPROVISIONED" state, to indicate that it's either ready or awaiting partner | ||
// activity. | ||
func waitForAttachmentToBeProvisioned(d *schema.ResourceData, config *Config, timeout time.Duration) error { | ||
return resource.Retry(timeout, func() *resource.RetryError { | ||
if err := resourceComputeInterconnectAttachmentRead(d, config); err != nil { | ||
return resource.NonRetryableError(err) | ||
} | ||
|
||
name := d.Get("name").(string) | ||
state := d.Get("state").(string) | ||
if state == "UNPROVISIONED" { | ||
return resource.RetryableError(fmt.Errorf("InterconnectAttachment %q has state %q.", name, state)) | ||
} | ||
log.Printf("InterconnectAttachment %q has state %q.", name, state) | ||
return nil | ||
}) | ||
} |
3 changes: 3 additions & 0 deletions
3
templates/terraform/post_create/interconnect_attachment.go.erb
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,3 @@ | ||
if err := waitForAttachmentToBeProvisioned(d, config, d.Timeout(schema.TimeoutCreate)); err != nil { | ||
return fmt.Errorf("Error waiting for InterconnectAttachment %q to be provisioned: %q", d.Get("name").(string), err) | ||
} |
3 changes: 3 additions & 0 deletions
3
templates/terraform/pre_delete/interconnect_attachment.go.erb
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,3 @@ | ||
if err := waitForAttachmentToBeProvisioned(d, config, d.Timeout(schema.TimeoutCreate)); err != nil { | ||
return fmt.Errorf("Error waiting for InterconnectAttachment %q to be provisioned: %q", d.Get("name").(string), err) | ||
} |