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_storage_account: PATCH is not valid in the allowed_methods of the cors_rule #6904

Closed
ghost opened this issue May 13, 2020 · 3 comments · Fixed by #6964
Closed

azurerm_storage_account: PATCH is not valid in the allowed_methods of the cors_rule #6904

ghost opened this issue May 13, 2020 · 3 comments · Fixed by #6964

Comments

@ghost
Copy link

ghost commented May 13, 2020

This issue was originally opened by @diegopeinador as hashicorp/terraform#24941. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.12.24
+ provider.azurerm v2.6.0

Terraform Configuration Files

provider "azurerm" {
  version = "=2.6"
  features {}
}

resource "azurerm_resource_group" "test-cors" {
  name     = "test-cors-RG"
  location = "West Europe"
}

resource "azurerm_storage_account" "test-cors" {
  name                     = "terraformtestcors"
  resource_group_name      = azurerm_resource_group.test-cors.name
  location                 = azurerm_resource_group.test-cors.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
  enable_https_traffic_only= true
  account_kind             = "StorageV2"
  static_website {
    index_document = "index.html"
  }
  blob_properties {
    cors_rule {
        allowed_headers    = ["x-ms-*"]
        allowed_methods    = [
            "PUT",
            "OPTIONS",
            "POST",
            "GET",
            "HEAD",
            "DELETE",
            "MERGE",
            "PATCH", # Not allowed by terraform CLI, but present on Azure
        ]
        allowed_origins    = ["http://localhost:61674"]
        exposed_headers    = ["x-ms-*"]
        max_age_in_seconds = 86400
    }
  }
  tags = {"DETELEME":"THIS IS A TEST"}
}

Debug Output

terraform validate:

Error: expected blob_properties.0.cors_rule.0.allowed_methods.7 to be one of [DELETE GET HEAD MERGE POST OPTIONS PUT], got PATCH

  on test-cors.tf line 11, in resource "azurerm_storage_account" "test-cors":
  11: resource "azurerm_storage_account" "test-cors" {

Expected Behavior

PATH To be a valid method.

Actual Behavior

Error from the validator

Steps to Reproduce

  1. terraform init
  2. terraform validate

Additional Context

In the Azure portal the patch is listed as a valid method:
Screenshot 2020-05-13 at 15 03 21

References

The documentation is consistent with the validator and doesn't list PATCH as a valid method for this parameter:
https://www.terraform.io/docs/providers/azurerm/r/storage_account.html#allowed_methods

@lrxtom2
Copy link
Contributor

lrxtom2 commented May 16, 2020

Submitted the PR to fix this issue.

@ghost
Copy link
Author

ghost commented May 22, 2020

This has been released in version 2.11.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 = "~> 2.11.0"
}
# ... other configuration ...

@ghost
Copy link
Author

ghost commented Jun 17, 2020

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!

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

Successfully merging a pull request may close this issue.

3 participants