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

data.azurerm_synapse_workspace: Add identity attribute #12098

Merged
merged 1 commit into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 26 additions & 0 deletions azurerm/internal/services/synapse/synapse_workspace_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@ func dataSourceSynapseWorkspace() *pluginsdk.Resource {
},
},

"identity": {
Type: pluginsdk.TypeList,
Computed: true,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"type": {
Type: pluginsdk.TypeString,
Computed: true,
},

"principal_id": {
Type: pluginsdk.TypeString,
Computed: true,
},

"tenant_id": {
Type: pluginsdk.TypeString,
Computed: true,
},
},
},
},

"tags": tags.SchemaDataSource(),
},
}
Expand Down Expand Up @@ -72,5 +95,8 @@ func dataSourceSynapseWorkspaceRead(d *pluginsdk.ResourceData, meta interface{})
if props := resp.WorkspaceProperties; props != nil {
d.Set("connectivity_endpoints", utils.FlattenMapStringPtrString(props.ConnectivityEndpoints))
}
if err := d.Set("identity", flattenArmWorkspaceManagedIdentity(resp.Identity)); err != nil {
return fmt.Errorf("setting `identity`: %+v", err)
}
return tags.FlattenAndSet(d, resp.Tags)
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ func TestAccDataSourceSynapseWorkspace_basic(t *testing.T) {
check.That(data.ResourceName).Key("name").Exists(),
check.That(data.ResourceName).Key("resource_group_name").Exists(),
check.That(data.ResourceName).Key("connectivity_endpoints.%").Exists(),
check.That(data.ResourceName).Key("identity.#").HasValue("1"),
check.That(data.ResourceName).Key("identity.0.principal_id").Exists(),
),
},
})
Expand Down
12 changes: 12 additions & 0 deletions website/docs/d/synapse_workspace.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,18 @@ the following Attributes are exported:

* `tags` - A mapping of tags assigned to the resource.

* `identity` - An `identity` block as defined below, which contains the Managed Service Identity information for this Synapse Workspace.

---

The `identity` block exports the following:

* `type` - The Identity Type for the Service Principal associated with the Managed Service Identity of this Synapse Workspace.

* `principal_id` - The Principal ID for the Service Principal associated with the Managed Service Identity of this Synapse Workspace.

* `tenant_id` - The Tenant ID for the Service Principal associated with the Managed Service Identity of this Synapse Workspace.

## Timeouts

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions:
Expand Down