Skip to content

Commit

Permalink
Merge pull request #13011 from hashicorp/r/aadds-resource-id
Browse files Browse the repository at this point in the history
domain_service: export `resource_id` attribute
  • Loading branch information
manicminer authored Aug 17, 2021
2 parents 1a8036b + 2c549b5 commit 600d4b7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ func dataSourceActiveDirectoryDomainService() *pluginsdk.Resource {
},
},

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

"secure_ldap": {
Type: pluginsdk.TypeList,
Computed: true,
Expand Down Expand Up @@ -258,6 +263,7 @@ func dataSourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta
d.Set("filtered_sync_enabled", true)
}

d.Set("resource_id", resp.ID)
d.Set("sku", props.Sku)
d.Set("sync_owner", props.SyncOwner)
d.Set("tenant_id", props.TenantID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ func resourceActiveDirectoryDomainService() *pluginsdk.Resource {
Computed: true,
},

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

"sync_owner": {
Type: pluginsdk.TypeString,
Computed: true,
Expand Down Expand Up @@ -434,6 +439,7 @@ func resourceActiveDirectoryDomainServiceRead(d *pluginsdk.ResourceData, meta in

d.Set("name", id.Name)
d.Set("resource_group_name", id.ResourceGroup)
d.Set("resource_id", resp.ID)

loc := location.NormalizeNilable(resp.Location)
d.Set("location", loc)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func TestAccActiveDirectoryDomainService_updateWithDatasource(t *testing.T) {
check.That(data.ResourceName).Key("initial_replica_set.0.domain_controller_ip_addresses.#").HasValue("2"),
check.That(data.ResourceName).Key("initial_replica_set.0.external_access_ip_address").Exists(),
check.That(data.ResourceName).Key("initial_replica_set.0.service_status").HasValue("Running"),
check.That(data.ResourceName).Key("resource_id").Exists(),
check.That(data.ResourceName).Key("secure_ldap.#").HasValue("1"),
check.That(data.ResourceName).Key("secure_ldap.0.enabled").HasValue("true"),
check.That(data.ResourceName).Key("secure_ldap.0.certificate_expiry").Exists(),
Expand Down Expand Up @@ -116,6 +117,7 @@ func TestAccActiveDirectoryDomainService_updateWithDatasource(t *testing.T) {
check.That(dataSourceData.ResourceName).Key("replica_sets.1.location").Exists(),
check.That(dataSourceData.ResourceName).Key("replica_sets.1.service_status").Exists(),
check.That(dataSourceData.ResourceName).Key("replica_sets.1.subnet_id").Exists(),
check.That(dataSourceData.ResourceName).Key("resource_id").Exists(),
check.That(dataSourceData.ResourceName).Key("secure_ldap.#").HasValue("1"),
check.That(dataSourceData.ResourceName).Key("secure_ldap.#").HasValue("1"),
check.That(dataSourceData.ResourceName).Key("secure_ldap.0.certificate_expiry").Exists(),
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/active_directory_domain_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ In addition to all arguments above, the following attributes are exported:

* `deployment_id` - A unique ID for the managed domain deployment.

* `resource_id` - The Azure resource ID for the domain service.

---

A `secure_ldap` block exports the following:
Expand Down

0 comments on commit 600d4b7

Please sign in to comment.