Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Resource: azurerm_data_factory_credential_user_managed_identity #24307

Merged
merged 25 commits into from
Jan 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
bruceharrison1984 committed Dec 21, 2023

Verified

This commit was signed with the committer’s verified signature.
DavideD Davide D'Alto
commit 59bd5bbb63ac456e568ff69864184724ab189606
Original file line number Diff line number Diff line change
@@ -69,6 +69,9 @@ func resourceDataFactoryCredentialsUserAssignedManagedIdentity() *pluginsdk.Reso
}
}

// user managed identities only have one type
const IDENTITY_TYPE = "ManagedIdentity"

func resourceDataFactoryCredentialsUserAssignedManagedIdentityCreateUpdate(d *pluginsdk.ResourceData, meta interface{}) error {
client := meta.(*clients.Client).DataFactory.Credentials
ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d)
@@ -95,17 +98,33 @@ func resourceDataFactoryCredentialsUserAssignedManagedIdentityCreateUpdate(d *pl
}

credential := credentials.ManagedIdentityCredentialResource{
Type: utils.String("ManagedIdentity"),
Properties: credentials.ManagedIdentityCredential{
Description: utils.String(d.Get("description").(string)),
Annotations: d.Get("annotations").(*[]interface{}),
TypeProperties: &credentials.ManagedIdentityTypeProperties{
ResourceId: utils.String(d.Get("identity_id").(string)),
},
},
Type: utils.String(IDENTITY_TYPE),
Properties: credentials.ManagedIdentityCredential{},
}

if v, ok := d.GetOk("annotations"); ok {
annotations := v.([]interface{})
credential.Properties.Annotations = &annotations
}

if v, ok := d.GetOk("description"); ok {
description := v.(string)
credential.Properties.Description = &description
}

if v, ok := d.GetOk("identity_id"); ok {
identityId := v.(string)
credential.Properties.TypeProperties.ResourceId = &identityId
}

if _, err := client.CredentialOperationsCreateOrUpdate(ctx, id, credential, credentials.CredentialOperationsCreateOrUpdateOperationOptions{}); err != nil {
return fmt.Errorf("creating %s: %+v", id, err)
}

d.SetId(id.ID())

return resourceDataFactoryCredentialsUserAssignedManagedIdentityRead(d, meta)
}

func resourceDataFactoryCredentialsUserAssignedManagedIdentityRead(d *pluginsdk.ResourceData, meta interface{}) error {
}