hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.59k stars 4.62k forks source link

azurerm_cosmosdb_account => cors_rule => max_age_in_seconds #22509

Closed carlo98100 closed 1 year ago

carlo98100 commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.5.2

AzureRM Provider Version

3.64.0

Affected Resource(s)/Data Source(s)

azurerm_cosmosdb_account

Terraform Configuration Files

resource "azurerm_cosmosdb_account" "cosmos-account" {
  name                = "cos-test"
  resource_group_name = azurerm_resource_group.robot-rg.name
  location            = azurerm_resource_group.robot-rg.location
  offer_type          = "Standard"
  kind                = "GlobalDocumentDB"

  tags = {
    "defaultExperience"       = "Core (SQL)"
    "hidden-cosmos-mmspecial" = ""
  }

  consistency_policy {
    consistency_level       = "Session"
    max_interval_in_seconds = 5
    max_staleness_prefix    = 100
  }

  geo_location {
    location          = azurerm_resource_group.robot-rg.location
    failover_priority = 0
  }

  cors_rule {
          allowed_headers    = []
          allowed_methods    = []
          allowed_origins    = [
             "https://localhost:7001",
             "http://localhost:7001",
            ]
          exposed_headers    = []
          max_age_in_seconds = 0
        }

  timeouts {

  }
}

Debug Output/Panic Output

╷
│ Error: expected cors_rule.0.max_age_in_seconds to be in the range (1 - 2000000000), got 0
│
│ with azurerm_cosmosdb_account.cosmos-account,
│ on main.tf line 101, in resource "azurerm_cosmosdb_account" "cosmos-account":
│ 101: max_age_in_seconds = 0
│

Expected Behaviour

When im running terraform plan, then im getting this error. But when im removing the cors section. Then im getting that it will change the current cosmos db account since the cors is missing. But when im checking the actual cosmos db account which is already live. Then it says that "max_age_in_seconds" is set to "0". Feels like a bug since I cant set it from my configuration but if I create it from the portal. Then it is 0 by default.

Actual Behaviour

It gives me the error that I've posted.

Steps to Reproduce

'terraform init' 'terraform plan'

Important Factoids

No response

References

No response

github-actions[bot] commented 5 months ago

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.