From 3997e503b8f47b53e27eb948a818d8cee1e48d24 Mon Sep 17 00:00:00 2001 From: Tom Bamford Date: Thu, 16 Nov 2023 17:35:09 +0000 Subject: [PATCH 1/2] data.azuread_application: updated resource ID --- docs/data-sources/application.md | 1 + internal/services/applications/application_data_source.go | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/data-sources/application.md b/docs/data-sources/application.md index 6fbf3d2024..9a66375a1a 100644 --- a/docs/data-sources/application.md +++ b/docs/data-sources/application.md @@ -51,6 +51,7 @@ The following attributes are exported: * `fallback_public_client_enabled` - The fallback application type as public client, such as an installed application running on a mobile device. * `feature_tags` - A `features` block as described below. * `group_membership_claims` - The `groups` claim issued in a user or OAuth 2.0 access token that the app expects. +* `id` - The Terraform resource ID for the application, for use when referencing this data source in your Terraform configuration. * `identifier_uris` - A list of user-defined URI(s) that uniquely identify a Web application within it's Azure AD tenant, or within a verified custom domain if the application is multi-tenant. * `logo_url` - CDN URL to the application's logo. * `notes` - User-specified notes relevant for the management of the application. diff --git a/internal/services/applications/application_data_source.go b/internal/services/applications/application_data_source.go index 85e44106b2..496ebc8921 100644 --- a/internal/services/applications/application_data_source.go +++ b/internal/services/applications/application_data_source.go @@ -6,6 +6,7 @@ package applications import ( "context" "fmt" + "github.com/hashicorp/terraform-provider-azuread/internal/services/applications/parse" "net/http" "strings" "time" @@ -578,7 +579,8 @@ func applicationDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, m return tf.ErrorDiagF(fmt.Errorf("Object ID returned for application is nil"), "Bad API Response") } - d.SetId(*app.ID()) + id := parse.NewApplicationID(*app.ID()) + d.SetId(id.ID()) tf.Set(d, "api", flattenApplicationApi(app.Api, true)) tf.Set(d, "app_roles", flattenApplicationAppRoles(app.AppRoles)) From 27dfb935cef539d65843bc86ba63f2485cf3cf19 Mon Sep 17 00:00:00 2001 From: Tom Bamford Date: Thu, 16 Nov 2023 17:37:04 +0000 Subject: [PATCH 2/2] goimports --- internal/services/applications/application_data_source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/applications/application_data_source.go b/internal/services/applications/application_data_source.go index 496ebc8921..1cf6628473 100644 --- a/internal/services/applications/application_data_source.go +++ b/internal/services/applications/application_data_source.go @@ -6,7 +6,6 @@ package applications import ( "context" "fmt" - "github.com/hashicorp/terraform-provider-azuread/internal/services/applications/parse" "net/http" "strings" "time" @@ -14,6 +13,7 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" + "github.com/hashicorp/terraform-provider-azuread/internal/services/applications/parse" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azuread/internal/tf/validation"