Skip to content

Commit

Permalink
Bug Fix Policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshit-Gupta2 authored and hkantare committed Dec 16, 2021
1 parent f5535fb commit 7b4887a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ibm/resource_ibm_kms_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,9 @@ func resourceIBMKmsKeyRead(d *schema.ResourceData, meta interface{}) error {
d.Set("endpoint_type", "public")
}
d.Set("type", crnData[4])
d.Set("force_delete", d.Get("force_delete").(bool))
if d.Get("force_delete") != nil {
d.Set("force_delete", d.Get("force_delete").(bool))
}
d.Set("key_ring_id", key.KeyRingID)
if key.Expiration != nil {
expiration := key.Expiration
Expand Down
6 changes: 5 additions & 1 deletion ibm/resource_ibm_kms_key_policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func resourceIBMKmsKeyPolicyCreate(context context.Context, d *schema.ResourceDa
return diag.Errorf("Could not create policies: %s", err)
}
d.SetId(key.CRN)
return resourceIBMKmsKeyPolicyUpdate(context, d, meta)
return resourceIBMKmsKeyPolicyRead(context, d, meta)
}

func resourceIBMKmsKeyPolicyRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
Expand Down Expand Up @@ -296,6 +296,10 @@ func resourceIBMKmsKeyPolicyUpdate(context context.Context, d *schema.ResourceDa
}

instanceID := d.Get("instance_id").(string)
CrnInstanceID := strings.Split(instanceID, ":")
if len(CrnInstanceID) > 3 {
instanceID = CrnInstanceID[len(CrnInstanceID)-3]
}
endpointType := d.Get("endpoint_type").(string)

rsConClient, err := meta.(ClientSession).ResourceControllerV2API()
Expand Down

0 comments on commit 7b4887a

Please sign in to comment.