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

Cannot change azurerm_eventhub_namespace from Standard to Basic due to auto-scale #10244

Closed
phatcher opened this issue Jan 19, 2021 · 2 comments · Fixed by #10536
Closed

Cannot change azurerm_eventhub_namespace from Standard to Basic due to auto-scale #10244

phatcher opened this issue Jan 19, 2021 · 2 comments · Fixed by #10536

Comments

@phatcher
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

Terraform v0.13.5

  • provider registry.terraform.io/hashicorp/azurerm v2.41.0

Affected Resource(s)

  • azurerm_eventhub_namespace

Terraform Configuration Files

Here's my module for configuring a Event Hub namespace in either Basic or Standard mode

locals {
  location = var.location == "global" ? var.region : var.location
  auto_inflate_enabled = var.sku == "Standard" ? true : false
  capacity = var.sku == "Standard" ? 1 : var.capacity
  maximum_throughput_units = var.sku == "Standard" ? var.capacity : 0
  zone_redundant = var.sku == "Standard" ? var.zone_redundant : null
}

resource "azurerm_eventhub_namespace" "this" {
  name                     = var.name
  location                 = var.location
  resource_group_name      = var.resource_group_name
  sku                      = var.sku
  capacity                 = local.capacity
  auto_inflate_enabled     = local.auto_inflate_enabled
  maximum_throughput_units = local.maximum_throughput_units

  identity {
    type = "SystemAssigned"
  }
}

Expected Behaviour

I should be able to go from Standard -> Basic

Actual Behaviour

If I have the code as is, i.e.

  auto_inflate_enabled = var.sku == "Standard" ? true : false
  maximum_throughput_units = var.sku == "Standard" ? var.capacity : 0

Then I get the error

eventhub.NamespacesClient#CreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: autorest/azure: Service returned an error. Status=<nil> Code="Conflict" Message="<Error><Code>409</Code><Detail>Namespace tier cannot be changed, as AutoInflate is not available in Basic tier. </Detail></Error>

If I change it so I'm not setting the auto-scale values

  auto_inflate_enabled = var.sku == "Standard" ? true : null
  maximum_throughput_units = var.sku == "Standard" ? var.capacity : null

, the provider correctly detects I'm in basic mode and set auto_inflate_enabled to false for me, but doesn't adjust the maximum_throughput_units value and I get the errror

Error: eventhub.NamespacesClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="BadRequest" Message="Cannot set MaximumThroughputUnits property if AutoInflate is not enabled.

So a suggestion is to also force the maximum_throughput_units to 0 if setting auto_inflate_enabled to false.

I can achieve the change via the portal, so it may be required to do two calls, one to remove auto scale and one to change the Sku from Standard -> Basic, but I'd expect the provider to do this rather than it being a client responsibility.

@katbyte katbyte added this to the v2.47.0 milestone Feb 11, 2021
katbyte pushed a commit that referenced this issue Feb 11, 2021
Fixes #10244.

In a corner case when we are downgrading from Standard to Basic SKU and namespace had both autoInflate enabled and
maximumThroughputUnits set - we need to force throughput units back to 0, otherwise downgrade fails
@ghost
Copy link

ghost commented Feb 11, 2021

This has been released in version 2.47.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.47.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 13, 2021

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 as resolved and limited conversation to collaborators Mar 13, 2021
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