GoogleCloudPlatform / terraformer

CLI tool to generate terraform files from existing infrastructure (reverse Terraform). Infrastructure to Code
Apache License 2.0
12.68k stars 1.66k forks source link

Correct application ID format in appendResource #1904

Open max-blue opened 3 months ago

max-blue commented 3 months ago

fixes issue #1902

fix(azuread): Correct application ID format in appendResource

Prepend "/applications/" to the application ID in the appendResource function to match the expected format of "/applications/{applicationId}". This resolves the parsing error during resource import for Azure AD applications.

google-cla[bot] commented 3 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

anthony-pastor commented 1 month ago

Thanks @max-blue Same thing for other resources:

--- a/providers/azuread/user.go
+++ b/providers/azuread/user.go
@@ -38,7 +38,8 @@ func (az *UserServiceGenerator) listResources() ([]msgraph.User, error) {
 func (az *UserServiceGenerator) appendResource(resource *msgraph.User) {
    id := resource.ID
-   az.appendSimpleResource(*id, *resource.DisplayName, "azuread_user")
+   fullID := "/users/" + *id
+   az.appendSimpleResource(fullID, *resource.DisplayName, "azuread_user")
 }
--- a/providers/azuread/group.go
+++ b/providers/azuread/group.go
@@ -38,7 +38,8 @@ func (az *GroupServiceGenerator) listResources() ([]msgraph.Group, error) {

 func (az *GroupServiceGenerator) appendResource(resource *msgraph.Group) {
    id := resource.ID
-   az.appendSimpleResource(*id, *resource.DisplayName+"-"+*id, "azuread_group")
+   fullID := "/groups/" + *id
+   az.appendSimpleResource(fullID, *resource.DisplayName+"-"+*id, "azuread_group")
 }

...