Closed Djiit closed 5 years ago
FYI : when not using interpolation with other resource (say, just var.*) in connection_string.value; things are fine. It might be related to some dependancy-management stuff.
hi @Djiit
Thanks for opening this issue :)
Taking a look into this, you're seeing the following error:
`Error: module.service.azurerm_app_service.app_service: connection_string: should be a list`
because a map is being provided to the module and not a list (which in turn means this configuration isn't valid). Unfortunately Terraform 0.11 doesn't allow a list of maps to be provided as input, as such this approach won't work at this time; however this should be possible in Terraform 0.12 using Rich Value Types.
Instead for the moment I'd suggest the best approach would be to pass these through as regular variables - for example:
module "app_service" {
source = "..."
default_connection_string = "Server=127.0.0.1; User ID=efvfewfqsfv; Password=rgfedfsvdfsfd"
}
# and within the module
variable "default_connection_string" {}
resource "azurerm_app_service" "app_service" {
# ...
connection_string {
name = "defaultConnection"
type = "MySQL"
value = "${var.default_connection_string}"
}
}
Would you be able to take a look and see if that works for you? Whilst it's unfortunate this approach requires defining a variable for each connection string in the short-term - the recommended approach isn't available until Terraform 0.12 comes out - but I believe that should work when this is released. Since this is a question about Terraform Configuration rather than a bug in Terraform I'm going to close this issue for the moment, however please let us know if that doesn't work for you and we'll take another look :)
Thanks!
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!
Community Note
Terraform (and AzureRM Provider) Version
Terraform v0.11.11
Affected Resource(s)
azurerm_app_service
Terraform Configuration Files
Debug Output
Expected Behavior
App Service should have been created with a correct connection_string attached.
Actual Behavior
Saw this error :
Error: module.service.azurerm_app_service.app_service: connection_string: should be a list
Steps to Reproduce