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

azuread_application: homepage can't be blank #268

Closed
magne opened this issue Jun 9, 2020 · 5 comments · Fixed by #298
Closed

azuread_application: homepage can't be blank #268

magne opened this issue Jun 9, 2020 · 5 comments · Fixed by #298

Comments

@magne
Copy link

magne commented Jun 9, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritise this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritise the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureAD Provider) Version

Terraform v0.12.26

  • provider.azuread v0.10.0

Affected Resource(s)

  • azuread_application

Terraform Configuration Files

resource "azuread_application" "api" {
  name     = "My App"
  homepage = ""

  oauth2_permissions {
    type                       = "User"
    value                      = "API.All"
    admin_consent_description  = "Access to the API."
    admin_consent_display_name = "Access to the API."
  }
}

Expected Behavior

I expected the application to be created with a blank homepage (I'm creating an internal API app registration, and it doesn't have an obvious homepage).

Actual Behavior

Terraform reports an error:

Error: expected "homepage" url to not be empty

Also, if I try to leave out homepage, terraform fails with:

Error: graphrbac.ApplicationsClient#Create: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="Unknown" Message="Unknown service error" Details=[{"odata.error":{"code":"Request_BadRequest","date":"2020-06-09T09:35:04","message":{"lang":"en","value":"Url is malformed paramName: WwwHomepage, paramValue: https://My App, objectType: Microsoft.Online.DirectoryServices.Application"},"requestId":"07137f59-663e-4292-bc3f-28ddddc14628","values":[{"item":"PropertyName","value":"homepage"},{"item":"PropertyErrorCode","value":"NotAWellFormedUrl"}]}}]

This happens because of the default value of https://{name} for homepage, since my app registration has a name that is unsuitable for an url.

The obvious workaround is of course to set homepage to a valid url, but this should not be necessary.

Steps to Reproduce

  1. terraform init
  2. terraform apply
@manicminer
Copy link
Contributor

@magne thanks for requesting this. I believe the current behaviour of setting a default homepage (signInUrl) might stem from supporting legacy application registrations, however I'll look further into that. We'll look at updating this to allow unsetting a homepage URL.

@manicminer
Copy link
Contributor

Just an update, this is a sticky one as the SDK (and possibly the AAD Graph API) does not support null values for the homepage (aka signInUrl), and as per the above report, it cannot be cleared by setting to an empty string.

I've opened a PR #278 to stop deriving a default value for homepage, which will hopefully mitigate the issue in that applications can be created without a homepage. This issue should remain open until we can resolve being able to unset the property.

I've opened an upstream issue Azure/azure-sdk-for-go#10463

@manicminer manicminer self-assigned this Jun 16, 2020
@manicminer manicminer added this to the v1.0.0 milestone Jun 26, 2020
@manicminer
Copy link
Contributor

Since changing the behavior of the homepage attribute could potentially break existing configurations, support for empty homepage values will be available in the next major version of the provider. Even so, there are caveats to what we can accomplish due to missing SDK support for clearing this field once it has been set. Kindly see the linked PR #278 for details.

@ghost
Copy link

ghost commented Sep 3, 2020

This has been released in version 1.0.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azuread" {
    version = "~> 1.0.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Oct 4, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants