I have the following Terraform resource for configuring an Azure app service:
resource "azurerm_app_service" "app_service" {
name = "Test-App-Service-3479112"
location = "${azurerm_resource_group.resource_group.location}"
resource_group_name = "${azurerm_resource_group.resource_group.name}"
app_service_plan_id = "${azurerm_app_service_plan.app_service_plan.id}"
site_config {
dotnet_framework_version = "v4.0"
remote_debugging_version = "VS2012"
}
app_settings {
"ASPNETCORE_ENVIRONMENT" = "test"
"WEBSITE_NODE_DEFAULT_VERSION" = "4.4.7"
}
}
I am attempting to add a CORS origin value to be utilized in my resource. Is there way to add this in Terraform, or if there is not, how could I go about configuring this in my Terraform file (possibly with the Azure SDK)?
All,
This is now available here: https://www.terraform.io/docs/providers/azurerm/r/app_service.html#cors
And here is my example:
resource "azurerm_app_service" "my-app" {
name = "${var.api_name}"
location = "${var.location}"
resource_group_name = "${var.resource_group}"
app_service_plan_id = "${azurerm_app_service_plan.api_asp.id}"
site_config {
cors {
allowed_origins = ["https://${var.ui_name}${var.dns_suffix}"]
}
}
identity = {
type = "SystemAssigned"
}
}
And proof that the above works:
Currently, it is not supported. You could check azurerm_app_service.
In currently terrform version, cors is not supported.
If possible, you could use Azure template to do this, you could check this example.
"properties": {
"cors": {
"allowedOrigins": [
"[concat('https://', parameters('siteName'), '.azurewebsites.net')]"
]
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With