-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azurerm_app_service: Adds support for CORS settings #2870
azurerm_app_service: Adds support for CORS settings #2870
Conversation
724e5ef
to
dc2db73
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @joakimhew
Thanks for this PR :)
I've taken a look through and this is off to a good start - if we can rebase this on top of master (to make the diff a little cleaner 😄) and fix up the comments this otherwise looks pretty good to me 👍
Thanks!
azurerm/helpers/azure/app_service.go
Outdated
@@ -207,11 +231,63 @@ func SchemaAppServiceSiteConfig() *schema.Schema { | |||
Type: schema.TypeString, | |||
Optional: true, | |||
}, | |||
|
|||
"cors": SchemaAppServiceCorsSettings(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this schema is also shared with the App Service Slot resource, could we add the same acceptance test / docs for that resource too?
12babd1
to
1c94f85
Compare
1c94f85
to
427bb9f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @joakimhew
Tried running the tests for this today and got the following:
Test ended in panic.
------- Stdout: -------
=== RUN TestAccAzureRMAppServiceSlot_http2Enabled
=== PAUSE TestAccAzureRMAppServiceSlot_http2Enabled
=== CONT TestAccAzureRMAppServiceSlot_http2Enabled
------- Stderr: -------
panic: Invalid address to set: []string{"site_config", "0", "cors", "0", "allowed_origins"}
goroutine 330 [running]:
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*ResourceData).Set(0xc0005af6c0, 0x29ed512, 0xb, 0x25f65e0, 0xc000734440, 0x0, 0x0)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/resource_data.go:191 +0x334
github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmAppServiceSlotRead(0xc0005af6c0, 0x29aad40, 0xc0006b4a80, 0xc000b42100, 0x0)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_app_service_slot.go:386 +0x1163
github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmAppServiceSlotUpdate(0xc0005af6c0, 0x29aad40, 0xc0006b4a80, 0xc000b421c0, 0x0)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_app_service_slot.go:322 +0x8c4
github.com/terraform-providers/terraform-provider-azurerm/azurerm.resourceArmAppServiceSlotCreate(0xc0005af6c0, 0x29aad40, 0xc0006b4a80, 0xc0005af6c0, 0x0)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/azurerm/resource_arm_app_service_slot.go:229 +0xe1a
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Resource).Apply(0xc00041f420, 0xc00073cdc0, 0xc0007a0680, 0x29aad40, 0xc0006b4a80, 0xc000552b01, 0x3d, 0x0)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/resource.go:225 +0x351
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema.(*Provider).Apply(0xc0006ddd50, 0xc00073c8c0, 0xc00073cdc0, 0xc0007a0680, 0x1, 0x481593, 0x0)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/helper/schema/provider.go:283 +0x9c
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.(*EvalApply).Eval(0xc0004b4e40, 0x2ef2360, 0xc000a54d00, 0x2, 0x2, 0x29e372e, 0x4)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/eval_apply.go:57 +0x226
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.EvalRaw(0x2eb27a0, 0xc0004b4e40, 0x2ef2360, 0xc000a54d00, 0x0, 0x0, 0x0, 0x0)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/eval.go:53 +0x156
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.(*EvalSequence).Eval(0xc0007ae540, 0x2ef2360, 0xc000a54d00, 0x2, 0x2, 0x29e372e, 0x4)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/eval_sequence.go:14 +0x9c
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.EvalRaw(0x2eb2ce0, 0xc0007ae540, 0x2ef2360, 0xc000a54d00, 0x26a9f20, 0x4ae4342, 0x2628940, 0xc000740de0)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/eval.go:53 +0x156
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.Eval(0x2eb2ce0, 0xc0007ae540, 0x2ef2360, 0xc000a54d00, 0xc0007ae540, 0x2eb2ce0, 0xc0007ae540, 0x2c24700)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/eval.go:34 +0x4d
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform.(*Graph).walk.func1(0x293fee0, 0xc000a84080, 0x0, 0x0)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/terraform/graph.go:126 +0xc45
github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/dag.(*Walker).walkVertex(0xc000493c00, 0x293fee0, 0xc000a84080, 0xc000af4880)
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/dag/walk.go:387 +0x367
created by github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/dag.(*Walker).Update
/opt/teamcity-agent/work/458e5e4800bd94f6/src/github.com/terraform-providers/terraform-provider-azurerm/vendor/github.com/hashicorp/terraform/dag/walk.go:310 +0x986
hey @joakimhew I hope you don't mind but so that we can get this merged I've pushed a commit which includes the changes requested above Thanks! |
dismissing since changes have been pushed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - thanks for this @joakimhew - I hope you don't mind me pushing a few commits to resolve the outstanding PR comments so that we can get this merged 👍
Thanks!
Ignoring some known test failures, the tests pass: Thanks again for this @joakimhew - hope you don't mind I've pushed a few commits to get this merged |
@tombuildsstuff Great stuff! Reached out to you on Slack but understand that you've been busy. Thanks for resolving the last comments!! 🎊 |
This has been released in version 1.24.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 1.24.0"
}
# ... other configuration ... |
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 👉 [email protected]. Thanks! |
This PR fixes #2848 and allows users to set CORS settings within the
site_config
section.Note that the issue mentions
support_credentials
as well. Unfortunately the SDK does not have support for this at the moment, but I've added a new expand/flatten function for CORS settings to easily extend the schema in the future