aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go
diff options
context:
space:
mode:
authorAlex Pilon <apilon@hashicorp.com>2019-02-22 18:24:37 -0500
committerAlex Pilon <apilon@hashicorp.com>2019-02-22 18:24:37 -0500
commit15c0b25d011f37e7c20aeca9eaf461f78285b8d9 (patch)
tree255c250a5c9d4801c74092d33b7337d8c14438ff /vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go
parent07971ca38143c5faf951d152fba370ddcbe26ad5 (diff)
downloadterraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.gz
terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.tar.zst
terraform-provider-statuscake-15c0b25d011f37e7c20aeca9eaf461f78285b8d9.zip
deps: github.com/hashicorp/terraform@sdk-v0.11-with-go-modules
Updated via: go get github.com/hashicorp/terraform@sdk-v0.11-with-go-modules and go mod tidy
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go')
-rw-r--r--vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go15
1 files changed, 12 insertions, 3 deletions
diff --git a/vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go b/vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go
index 28ad105..94fef3c 100644
--- a/vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go
+++ b/vendor/github.com/hashicorp/terraform/helper/resource/testing_import_state.go
@@ -16,15 +16,24 @@ func testStepImportState(
16 state *terraform.State, 16 state *terraform.State,
17 step TestStep) (*terraform.State, error) { 17 step TestStep) (*terraform.State, error) {
18 // Determine the ID to import 18 // Determine the ID to import
19 importId := step.ImportStateId 19 var importId string
20 if importId == "" { 20 switch {
21 case step.ImportStateIdFunc != nil:
22 var err error
23 importId, err = step.ImportStateIdFunc(state)
24 if err != nil {
25 return state, err
26 }
27 case step.ImportStateId != "":
28 importId = step.ImportStateId
29 default:
21 resource, err := testResource(step, state) 30 resource, err := testResource(step, state)
22 if err != nil { 31 if err != nil {
23 return state, err 32 return state, err
24 } 33 }
25
26 importId = resource.Primary.ID 34 importId = resource.Primary.ID
27 } 35 }
36
28 importPrefix := step.ImportStateIdPrefix 37 importPrefix := step.ImportStateIdPrefix
29 if importPrefix != "" { 38 if importPrefix != "" {
30 importId = fmt.Sprintf("%s%s", importPrefix, importId) 39 importId = fmt.Sprintf("%s%s", importPrefix, importId)