-
Notifications
You must be signed in to change notification settings - Fork 626
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
access.api.error.invalid_cors_methods #779
Comments
Are you defining the allowed methods anywhere? If you're setting the allowed origins, you need methods to accompany it. |
I was able to replicate your issue and the cause is that the CORS methods are missing. You can solve this by either adding the single |
rpc error: code = Canceled desc = context canceled
rpc error: code = Unavailable desc = transport is closing |
Can you please run it again with FWIW, here is my working test case. variable "cloudflare_email" {}
variable "cloudflare_api_key" {}
variable "cloudflare_zone_id" {}
variable "cloudflare_domain" {}
provider "cloudflare" {
email = var.cloudflare_email
api_key = var.cloudflare_api_key
}
resource "cloudflare_access_application" "app" {
zone_id = var.cloudflare_zone_id
name = "test"
domain = var.cloudflare_domain
session_duration = "24h"
cors_headers {
allow_all_origins = true
allow_all_methods = true
}
} |
I thought the problem was my account so I raised an issue with CF.
I think my state is messed up too now because I'm unable to run the plugin again even if I remove all CF resource blocks. Edit: The example above works with a separate new tf file. |
Can you paste the resource from the state file? We might be able to help munge it back to a workable state. |
I can confirm that fiddling with the state fixes it. The original object caused a nil point deference with: {
"module": "xxxx",
"mode": "managed",
"type": "cloudflare_access_application",
"name": "app",
"provider": "provider.cloudflare",
"instances": [
{
"schema_version": 0,
"attributes": {
"allowed_idps": [],
"aud": "xxxx",
"auto_redirect_to_identity": false,
"cors_headers": [
{
"allow_all_headers": false,
"allow_all_methods": false,
"allow_all_origins": true,
"allow_credentials": false,
"allowed_headers": null,
"allowed_methods": null,
"allowed_origins": null,
"max_age": 0
}
],
"domain": "xxxx",
"id": "xxxxx",
"name": "xxxx",
"session_duration": "24h",
"zone_id": "xxxxxx"
},
"private": "xxxx"
}
]
}, I changed the |
We don't need another issue; I can dig into getting into this situation and then ensuring we can recover a bit better. Thanks for the resources and I'm glad you were about to get it back working. |
…d origin combinations In the event where someone neglects to use the right combination of allowed methods and origins, we should raise an error. This surfaced in cloudflare#779 and ended up needing the state manually modified to get it to a usable state again. Fixes cloudflare#779
@danielepolencic I've pushed up a validation fix for this one via #793. Would you mind taking a look and letting me know if that works for you? |
Terraform Version
0.12.26
Affected Resource(s)
cloudflare_access_application
Terraform Configuration Files
Debug Output
I tried with the provider on
2.10.1
and2.9.0
. Same error (actually worse errors with2.10.1
).The text was updated successfully, but these errors were encountered: