Skip to content

Commit

Permalink
Import a resource provisioned with key_protect_id and key_protect_ins…
Browse files Browse the repository at this point in the history
…tance attributes set (#5798)
  • Loading branch information
lornakelly authored Nov 18, 2024
1 parent cd54467 commit 2af014a
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 6 deletions.
8 changes: 8 additions & 0 deletions ibm/service/database/resource_ibm_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -1604,6 +1604,14 @@ func resourceIBMDatabaseInstanceRead(context context.Context, d *schema.Resource
if endpoint, ok := instance.Parameters["service-endpoints"]; ok {
d.Set("service_endpoints", endpoint)
}

if encryptionInstance, ok := instance.Parameters["disk_encryption_instance_crn"]; ok {
d.Set("key_protect_instance", encryptionInstance)
}

if encryptionKey, ok := instance.Parameters["disk_encryption_key_crn"]; ok {
d.Set("key_protect_key", encryptionKey)
}
}

d.Set(flex.ResourceName, *instance.Name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func TestAccIBMDatabaseInstanceElasticsearchPlatinumImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes", "plan_validation"},
"wait_time_minutes", "plan_validation", "deletion_protection"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ func TestAccIBMDatabaseInstanceElasticsearchImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes"},
"wait_time_minutes", "deletion_protection"},
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion ibm/service/database/resource_ibm_database_etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestAccIBMDatabaseInstanceEtcdImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes"},
"wait_time_minutes", "deletion_protection"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func TestAccIBMDatabaseInstancePostgresImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes"},
"wait_time_minutes", "deletion_protection"},
},
},
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func TestAccIBMDatabaseInstanceRabbitmqImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes"},
"wait_time_minutes", "deletion_protection"},
},
},
})
Expand Down
2 changes: 1 addition & 1 deletion ibm/service/database/resource_ibm_database_redis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestAccIBMDatabaseInstanceRedisImport(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"wait_time_minutes"},
"wait_time_minutes", "deletion_protection"},
},
},
})
Expand Down

0 comments on commit 2af014a

Please sign in to comment.