Skip to content
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

Merged

Conversation

joakimhew
Copy link
Contributor

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

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a 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 Show resolved Hide resolved
azurerm/helpers/azure/app_service.go Outdated Show resolved Hide resolved
azurerm/helpers/azure/app_service.go Outdated Show resolved Hide resolved
azurerm/resource_arm_app_service_test.go Show resolved Hide resolved
azurerm/helpers/azure/app_service.go Outdated Show resolved Hide resolved
@@ -207,11 +231,63 @@ func SchemaAppServiceSiteConfig() *schema.Schema {
Type: schema.TypeString,
Optional: true,
},

"cors": SchemaAppServiceCorsSettings(),
Copy link
Contributor

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?

website/docs/r/app_service.html.markdown Outdated Show resolved Hide resolved
azurerm/resource_arm_app_service_test.go Outdated Show resolved Hide resolved
@joakimhew joakimhew force-pushed the feature/2848_app_service_cors_support branch from 1c94f85 to 427bb9f Compare February 23, 2019 14:37
@ghost ghost added size/L and removed size/XXL labels Feb 23, 2019
@tombuildsstuff tombuildsstuff modified the milestones: 1.23.0, 1.25.0 Mar 5, 2019
@tombuildsstuff tombuildsstuff modified the milestones: v1.25.0, v1.24.0 Mar 14, 2019
Copy link
Collaborator

@katbyte katbyte left a 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

@ghost ghost added size/XL and removed size/L labels Mar 29, 2019
@tombuildsstuff
Copy link
Contributor

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!

@tombuildsstuff tombuildsstuff dismissed stale reviews from katbyte and themself March 29, 2019 10:57

dismissing since changes have been pushed

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a 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!

@tombuildsstuff
Copy link
Contributor

Ignoring some known test failures, the tests pass:

Screenshot 2019-03-29 at 15 48 17

Thanks again for this @joakimhew - hope you don't mind I've pushed a few commits to get this merged

@tombuildsstuff tombuildsstuff merged commit d27c3c5 into hashicorp:master Mar 29, 2019
tombuildsstuff added a commit that referenced this pull request Mar 29, 2019
@joakimhew
Copy link
Contributor Author

@tombuildsstuff Great stuff! Reached out to you on Slack but understand that you've been busy. Thanks for resolving the last comments!! 🎊

@ghost
Copy link

ghost commented Apr 3, 2019

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 ...

@ghost
Copy link

ghost commented Apr 29, 2019

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!

@ghost ghost locked and limited conversation to collaborators Apr 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CORS settings for App Service
3 participants