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_api_management in 2.7.0 fails with error "Certificate management for the default domain is not allowed" after update #6621

Closed
kensykora opened this issue Apr 24, 2020 · 5 comments · Fixed by #6850

Comments

@kensykora
Copy link

As of 2.6.0 we had a config that looked like this:

resource "azurerm_api_management" "api-management" {
  location            = "East US"
  name                = "contoso-apimgmt"
  publisher_email     = "[email protected]"
  publisher_name      = "Contoso"
  resource_group_name = "rg"

  identity {
    type = "SystemAssigned"
  }

  sku_name = "Developer_1"

  tags = local.common_tags

  policy {
    xml_content = <<XML
  <policies>
    <inbound>
        <cors>
            <allowed-origins>
              %{for origin in var.cors_origins~}
                <origin>${origin}</origin>
              %{endfor~}
            </allowed-origins>
            <allowed-methods>
                <method>GET</method>
                <method>POST</method>
                <method>PUT</method>
                <method>DELETE</method>
                <method>OPTIONS</method>
                <method>PATCH</method>
            </allowed-methods>
            <allowed-headers>
                <header>*</header>
            </allowed-headers>
        </cors>
    </inbound>
    <backend>
        <forward-request />
    </backend>
    <outbound />
    <on-error />
  </policies>
  XML
  }
}

When running terraform apply to this config after updating to azurerm 2.7.0, we get this error

module.perimeter.azurerm_api_management.api-management: Modifying... [id=/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.ApiManagement/service/contoso-apimgmt]
                                                                                                                                                                                      ment/service/contoso-apimgmt]
Error: creating/updating API Management Service "contoso-apimgmt" (Resource Group "rg"): apimanagement.ServiceClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="NotSupported" Message="Certificate management for the default domain 'contoso-apimgmt.azure-api.net' is not allowed."         

Workaround is to downgrade to 2.6.0. After forcing 2.7.0 to use 2.6.0, apply is successful.

terraform {
  required_providers {
    # Locks into AzureRM 2.6.0 to work around this bug: 
    azurerm = "~>2.6.0"
  }
}

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

PS C:\Users\kensy\Workspace\Infrastructure\environments\dev> terraform -v
Terraform v0.12.24
+ provider.azuread v0.8.0
+ provider.azurerm v2.7.0
+ provider.random v2.2.1

Affected Resource(s)

  • azurerm_api_management

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

Panic Output

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

@yupwei68
Copy link
Contributor

hi @kensykora , thanks for opening this issue. I could not reproduce this error with the code above. Could you try to apply this resource again to see whether this error still runs out?

@markti
Copy link
Contributor

markti commented Apr 27, 2020

I experienced this exact same issue. I tried to downgrade but I had already transitioned from properties to named values. My APIM is totally unmanageable now. :( very disappointed.

@yupwei68 the error comes when you simply make any change to the policy code.

i had to

  • go back to 2.7.0
  • remove the entire APIM hierarchy (230 resources)
  • remove any named_values (new in 2.7.0)
  • downgrade to 2.6.0...

big oof...

@yupwei68
Copy link
Contributor

hi @markti ,thanks for your help. I can reproduce it now. This is a regression bug for azurerm_api_management, and we'll fix it later.

@tombuildsstuff tombuildsstuff added this to the v2.10.0 milestone May 12, 2020
katbyte pushed a commit that referenced this issue May 13, 2020
… if not empty (#6850)

When the fields are set to empty strings instead of null, the error message in #6621 is given. When set to null when empty strings, the update goes through.

Fixes #6621.
@ghost
Copy link

ghost commented May 15, 2020

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

@ghost
Copy link

ghost commented Jun 13, 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 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants