0.12.14+ and using azuread_application - uuid string is wrong length

Updated to 0.12.14 today and started receiving the 0.12 changes warning…

"Terraform 0.11 and earlier required all non-constant expressions to be provided via interpolation syntax, but this pattern is now deprecated. To silence this warning, remove the “${ sequence from the start and the }” sequence from the end of this expression, leaving just the inner expression.
Template interpolation syntax is still used to construct strings from expressions when the template includes multiple interpolation sequences or a mixture of literal strings and interpolations. This deprecation applies only to templates that consist entirely of a single interpolation sequence."

This was my code… (the variable are variables that are substituted)

resource “azuread_application” “go-1” {
name = “azappregprefix-azwebapp1
available_to_other_tenants = false
oauth2_allow_implicit_flow = true

required_resource_access {
resource_app_id = “00000002-0000-0000-c000-000000000000”

resource_access {
id = “nnnnnn-nnnnnn-nnnnn-nnnnnn-nnnnnnnnn”
type = “Scope”
}
}
}

resource “azuread_service_principal” “go-1” {
application_id = "azuread_application.go-1.application_id"
}

After changing to match the 0.12 rules, the last line errors on VALIDATE (in bold above in the code)…

Error: “application_id” isn’t a valid UUID (“azuread_application.go-1.application_id”): uuid string is wrong length


*** on main.tf line 74, in resource “azuread_service_principal” “go-1”:***
*** 74: resource “azuread_service_principal” “go-1” {***

As far as I’m concerned this follows what is documented here…

Is this now broken?

It passes OK as…
application_id = “${azuread_application.go-1.application_id}”
…but with the warnings

You left the double quotes around the reference. It should be:

resource "azuread_service_principal" "go-1" {
  application_id = azuread_application.go-1.application_id
}
1 Like

@bhalor Thanks, that sorted it

Does the required_resource_access part work for you? I’m following the exact same structure shown in the documentation but I’m getting a 400 error saying “Property requiredResourceAccess.resourceAccess is invalid.”

Sorry to change the topic a bit, but I’m really struggling with it. Thanks in advance!