Skip to content

Commit

Permalink
Add delete for AP resource package association
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwilcox9 committed Jul 14, 2023
1 parent c3f4885 commit 0dd7b39
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,17 @@ func accessPackageResourcePackageAssociationResourceRead(ctx context.Context, d
}

func accessPackageResourcePackageAssociationResourceDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
log.Printf("[WARN] azuread_access_package_resource_package_association with ID %q must be manually deleted as there is no valid API provided for this operation", d.Id())
client := meta.(*clients.Client).IdentityGovernance.AccessPackageResourceRoleScopeClient

id, err := parse.AccessPackageResourcePackageAssociationID(d.Id())
if err != nil {
return tf.ErrorDiagPathF(err, "id", "Failed to parse resource ID %q", d.Id())
}

status, err := client.Delete(ctx, id.AccessPackageId, id.ResourcePackageAssociationId)
if err != nil {
return tf.ErrorDiagPathF(err, "id", "Deleting access package resource association with object ID %q, got status %d", id.ResourcePackageAssociationId, status)
}

return nil
}

0 comments on commit 0dd7b39

Please sign in to comment.