hashicorp / terraform-provider-azuread

Terraform provider for Azure Active Directory
https://registry.terraform.io/providers/hashicorp/azuread/latest/docs
Mozilla Public License 2.0
415 stars 280 forks source link

azuread_application_identifier_uri parsing error for hostnames exactly 10 characters long #1401

Open bwrogo opened 1 month ago

bwrogo commented 1 month ago

Community Note

Terraform (and AzureAD Provider) Version

terraform 1.7.4

Affected Resource(s)

Terraform Configuration Files

  resource "azuread_application_registration" "example" {
    display_name = "test_saml_application"
  }

  resource "azuread_application_identifier_uri" "example" {
    application_id = azuread_application_registration.example.id
    identifier_uri = "https://methenwegoyouuse.mywebsit.net/some-thing/auth/saml-endpoint.cgi?p=sp4"
  }

Debug Output

  Planning failed. Terraform encountered an error while generating this plan.

  â•·
  │ Error: parsing "/applications/{redacted_saml_app_id}/identifierUris/aHR0cHM6Ly9tZXRoZW53ZWdveW91dXNlLm15d2Vic2l0Lm5ldC9zb21lLXRoaW5nL2F1dGgvc2FtbC1lbmRwb2ludC5jZ2k/cD1zcDQ=": unexpected segment "cD1zcDQ=" present at the end of the URI (input "/applications/{redacted_saml_app_id}/identifierUris/aHR0cHM6Ly9tZXRoZW53ZWdveW91dXNlLm15d2Vic2l0Lm5ldC9zb21lLXRoaW5nL2F1dGgvc2FtbC1lbmRwb2ludC5jZ2k/cD1zcDQ=")
  │ 
  │   with azuread_application_identifier_uri.example,
  │   on main.tf line 18, in resource "azuread_application_identifier_uri" "example":
  │   18: resource "azuread_application_identifier_uri" "example" {
  │ 
  │ parsing
  │ "/applications/{redacted_saml_app_id}/identifierUris/aHR0cHM6Ly9tZXRoZW53ZWdveW91dXNlLm15d2Vic2l0Lm5ldC9zb21lLXRoaW5nL2F1dGgvc2FtbC1lbmRwb2ludC5jZ2k/cD1zcDQ=":
  │ unexpected segment "cD1zcDQ=" present at the end of the URI (input
  │ "/applications/{redacted_saml_app_id}/identifierUris/aHR0cHM6Ly9tZXRoZW53ZWdveW91dXNlLm15d2Vic2l0Lm5ldC9zb21lLXRoaW5nL2F1dGgvc2FtbC1lbmRwb2ludC5jZ2k/cD1zcDQ=")
  ╵

Panic Output

Expected Behavior

The Identifier URI should be registered correctly in Azure Entra ID.

Actual Behavior

The encoding of a 10 character host name is generating a forward slash / which causes a parsing error.

Steps to Reproduce

  1. terraform apply

Important Factoids

References

Is it possible that the encoding in the provider code is being done through StdEncoding vs URLEncoding?