hashicorp / terraform-provider-azuread

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

AzureAD Application URL's being modified #6

Closed guri-s closed 5 years ago

guri-s commented 6 years ago

Community Note

Terraform (and AzureRM Provider) Version

Affected Resource(s)

azurerm_azuread_application.sampleapp

Terraform Configuration Files

resource "azurerm_azuread_application" "sampleapp" {
  name                       = "SampleApp"
  homepage                   = "https://sampleapp.com/"
  identifier_uris            = [
                                "https://sampleapp.com/",
                                "https://sampleapp.onmicrosoft.com/00000000-0000-0000-0000-00000000"
                                ]
  reply_urls                 = [
                                "https://my.sampleapp.com/"
                                       ]
  available_to_other_tenants = false
  oauth2_allow_implicit_flow = false
}

resource "azurerm_azuread_service_principal" "sampleapp" {
  application_id = "00000000-0000-0000-0000-000000000000"
}

Expected Behavior

The azuread_application was imported in Terraform azurerm provider version = 1.15. So nothing is expected to happen as the .tf files have not been modified.

Actual Behavior

Now after when the provider was updated to version 1.18 and also on 1.19, terraform wants to modify the reply url's as below: ~ azurerm_azuread_application.cognos reply_urls.1: "https://sampleapp.onmicrosoft.com/00000000-0000-0000-0000-00000000" => "https://my.sampleapp.com/"

As per the .tf file for the app, the Reply URL is correct but terraform wants to modify it & the terraform state file also has the correct reply URL when I looked at the state file.

But when running terraform plan it thinks that the IdentifierURI is the Reply URL & wants to modify when in reality they are correct. Its confused into thinking that IdentifierURI is the Reply URL when the state file has it correct.

Now I can get away with this without putting the Reply URL or Identifier URI in the .tf file as below:

resource "azurerm_azuread_application" "sampleapp" {
  name                       = "SampleApp"
  homepage                   = "https://sampleapp.com/"
  available_to_other_tenants = false
  oauth2_allow_implicit_flow = false
}

resource "azurerm_azuread_service_principal" "sampleapp" {
  application_id = "00000000-0000-0000-0000-000000000000"
}

running hcl terrfaform plan with the above file does not result into terraform wanting to do any modification.

This looks like a bug in the newer provider version as the same config worked in previous versions without any issues.

Steps to Reproduce

  1. terraform plan

Important Factoids

References

katbyte commented 5 years ago

Hi @guri-s,

As in 2.0 we are deprecating all Azure AD resources and data sources in the Azure RM provider in favour of this new provider I have moved the issue here.

katbyte commented 5 years ago

Hi @guri-s,

Sorry to see that azurerm v1.19 broke your process. A typo introduced a bug and I have fixed it here in #21 and back ported the fix to azurerm.

guri-s commented 5 years ago

@katbyte thanks, will test & report back once new version on the provider is rolled out.

ghost commented 5 years ago

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 👉 hashibot-feedback@hashicorp.com. Thanks!