> terraform -v
Terraform v0.12.0-alpha4 (2c36829d3265661d8edbd5014de8090ea7e2a076)
+ provider.azurerm v1.21.0
+ provider.random v2.0.0
resource "azurerm_app_service" "backend" {
app_settings {
"spring.profiles.active" = "${var.SPRING_PROFILE}"
}
# the rest omitted for brevity
}
In Terraform v 0.11.x, this created an app setting with the key spring.profiles.active and all was good.
In Terraform v 0.12.0-alpha, quoted argument names are disallowed. Therefore, I can't set this app setting.
How do I set an app setting with dots (or other characters illegal in argument names) in them?
Hi @tomasaschan,
Since app_settings is an attribute rather than a nested block, you can write it with an equals sign to tell Terraform that what follows is a map expression:
resource "azurerm_app_service" "backend" {
app_settings = {
"spring.profiles.active" = "${var.SPRING_PROFILE}"
}
}
The configuration upgrade tool coming in v0.12.0 final will fix this automatically. The alpha4 release contains an incomplete implementation of this which you can try if you like, by running terraform 0.12upgrade in the directory which contains that configuration file. You should see it rewrite that item to be an attribute definition rather than a block definition by adding the equals sign, along with other changes to use new 0.12 syntax features.
Ah, nice. That is a lot simpler than I thought it would be :)
Is there a list of syntax changes between 0.11 and 0.12 somewhere that I can peek at to see if there are other changes I should make to my templates in preparation?
Generally speaking I would suggest not making changes proactively and instead just continuing to write configuration in the 0.11 style until you're actually upgrading to 0.12. Then you can use the included upgrade tool to bulk-rewrite any old-style usage to the new style, review the proposed changes using your version control system, and merge them all together.
The upgrade tool should, for most people, be much more convenient than working through a list of changes and applying them by hand, since it can see your old configuration, make changes as needed, and (in some less common cases) flag any specific constructs with contextual information so you can decide how best to update it.
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Hi @tomasaschan,
Since
app_settingsis an attribute rather than a nested block, you can write it with an equals sign to tell Terraform that what follows is a map expression:The configuration upgrade tool coming in v0.12.0 final will fix this automatically. The alpha4 release contains an incomplete implementation of this which you can try if you like, by running
terraform 0.12upgradein the directory which contains that configuration file. You should see it rewrite that item to be an attribute definition rather than a block definition by adding the equals sign, along with other changes to use new 0.12 syntax features.