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

bugfixes for ID parsing #1499

Merged
merged 18 commits into from
Sep 27, 2024
Merged

bugfixes for ID parsing #1499

merged 18 commits into from
Sep 27, 2024

Conversation

manicminer
Copy link
Contributor

@manicminer manicminer commented Sep 27, 2024

  • data.azuread_group: fix ID parsing bugs and some panics
  • azuread_conditional_access_policy: fix parsing bug for authentication_strength_policy_id
  • azuread_service_principal_certificate: fix parsing bug for service_principal_id
  • azuread_service_principal_claims_mapping_policy_assignment: fix parsing bug for service_principal_id
  • azuread_service_principal_password: fix parsing bug for service_principal_id
  • azuread_service_principal_token_signing_certificate: fix parsing bug for service_principal_id
  • azuread_synchronization_job: fix parsing bug for service_principal_id
  • azuread_synchronization_job_provision_on_demand: fix parsing bugs for service_principal_id and synchronization_job_id
  • azuread_synchronization_secret: fix parsing bug for service_principal_id

and documentation updates

Resolves: #1497
Resolves: #1498

Test results

Conditional Access

Screenshot 2024-09-27 at 14 01 57

Groups

Failures unrelated.

Screenshot 2024-09-27 at 13 54 30

Service Principals

Screenshot 2024-09-27 at 13 35 18

Synchronization

Screenshot 2024-09-27 at 13 41 48

@wiebeck
Copy link

wiebeck commented Sep 27, 2024

Also got ID parsing errors on azuread_directory_role_assignment and azuread_service_principal_delegated_permission_grant. See #1497 (comment)

…ead_service_principal_delegated_permission_grant` - user segment is not a UUID
@manicminer manicminer requested a review from a team September 27, 2024 13:04
Copy link
Member

@jackofallops jackofallops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @manicminer - LGTM 👍

@manicminer manicminer merged commit cfe1d91 into main Sep 27, 2024
28 checks passed
@manicminer manicminer deleted the bugfix/id-fixes branch September 27, 2024 13:15
manicminer added a commit that referenced this pull request Sep 27, 2024
@enorlando
Copy link

enorlando commented Sep 30, 2024

hi @manicminer, has the azuread_service_principal_password and azuread_service_principal_token_signing_certificate parsing issue been resolved under this PR as we are still getting an error after upgrading to latest provider version 3.0.1

Error: parsing "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx": parsing the ServicePrincipal ID: the number of segments didn't match
│ 
│ Expected a ServicePrincipal ID that matched (containing 2 segments):
│ 
│ > /servicePrincipals/servicePrincipalId
│ 
│ However this value was provided (which was parsed into 0 segments):
│ 
│ > xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
│ 
│ The following Segments are expected:
│ 
│ * Segment 0 - this should be the literal value "servicePrincipals"
│ * Segment 1 - this should be the user specified value for this servicePrincipalId [for example "servicePrincipalId"]
│ 
│ The following Segments were parsed:
│ 
│ * Segment 0 - not found
│ * Segment 1 - not found
│ 
│ 
│   with azuread_service_principal_password.xx,
│   on file.tf line 12357, in resource "azuread_service_principal_password" "xxt":
│ 12357:   service_principal_id = azuread_service_principal.xx.object_id
│ Error: parsing tokenSigningCertificate key value with ID "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
│ 
│   with azuread_service_principal_token_signing_certificate.xx,
│   on file.tf line 9519, in resource "azuread_service_principal_token_signing_certificate" "xx":
│ 9519: resource "azuread_service_principal_token_signing_certificate" "xx" {
│ 
│ parsing certificate block data: x509: malformed certificate

@manicminer
Copy link
Contributor Author

@enorlando It should have been resovled - could you post your config?

@rich-moneybox
Copy link

rich-moneybox commented Sep 30, 2024

I'm also seeing a problem with the azuread_service_principal_password:

resource "azuread_application" "devops_application" {
  display_name = "devops_test02_application"
}

resource "azuread_service_principal" "devops" {
  client_id = azuread_application.devops_application.client_id
}

resource "azuread_service_principal_password" "client_secret" {
  service_principal_id = azuread_service_principal.devops.object_id
}

This gives issue as described above, e.g.:

 Expected a ServicePrincipal ID that matched (containing 2 segments):
│
│ > /servicePrincipals/servicePrincipalId

@manicminer
Copy link
Contributor Author

@rich-moneybox You'll need to use the id attribute here rather than object_id. Please refer to the documentation for that resource for example usage. Thanks!

@enorlando
Copy link

@enorlando It should have been resovled - could you post your config?

It seems I was using the wrong attribute ID and required to re import into state the troubled tokenSigningCertificate. Thanks for the assistance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment