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

Error create ManagementGroup with Subscription #10937

Closed
WhiteTomX opened this issue Mar 11, 2021 · 4 comments · Fixed by #10948
Closed

Error create ManagementGroup with Subscription #10937

WhiteTomX opened this issue Mar 11, 2021 · 4 comments · Fixed by #10948

Comments

@WhiteTomX
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.14.8
+ provider registry.terraform.io/hashicorp/azurerm v2.50.0
+ provider registry.terraform.io/hashicorp/random v3.1.0

Affected Resource(s)

  • azurerm_management_group

Terraform Configuration Files

provider "azurerm" {
  features {}
}

resource "random_uuid" "qby_full_managed" {}

data "azurerm_subscription" "current" {
}

resource "azurerm_management_group" "qby_full_managed" {
  display_name               = "Full Managed Services"
  name                       = random_uuid.qby_full_managed.result

  subscription_ids = [
    data.azurerm_subscription.current.id
  ]
}

Debug Output

https://gist.github.com/WhiteTomX/85f3167a325f7477b59171473a2b6ea2

Expected Behaviour

Management Group is created and Subscription is moved to ManagementGroup

Actual Behaviour

Error: [DEBUG] Error assigning Subscription ID "/subscriptions/aff5a812-0595-4545-8b0e-527b199b4928" to Management Group "4b713daf-bbf6-fb10-1e3a-b546dedd9f07": managementgroups.SubscriptionsClient#Create: Failure responding to request: StatusCode=500 -- Original Error: autorest/azure: error response cannot be parsed: "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\r\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"/>\r\n<title>500 - Internal server error.</title>\r\n<style type=\"text/css\">\r\n<!--\r\nbody{margin:0;font-size:.7em;font-family:Verdana, Arial, Helvetica, sans-serif;background:#EEEEEE;}\r\nfieldset{padding:0 15px 10px 15px;} \r\nh1{font-size:2.4em;margin:0;color:#FFF;}\r\nh2{font-size:1.7" error: invalid character '<' looking for beginning of value

  on main.tf line 10, in resource "azurerm_management_group" "qby_full_managed":
  10: resource "azurerm_management_group" "qby_full_managed" {

The Management Group is created. Just the subscription is not moved.

Steps to Reproduce

  1. terraform apply
@jackofallops
Copy link
Member

Hi @WhiteTomX - From the error message provided this appears to be a server-side internal error, rather than a problem with the Provider. Looking at your config, this may be due to the referenced property. You can fix this there by referencing the subscription_id property, which is the subscription's GUID, rather than the Resource ID as provided by .id. I'll take a look at adding some schema validation to help prevent this in future.

e.g.

subscription_ids = [
    data.azurerm_subscription.current.subscrption_id
  ]

Hope that helps!

@WhiteTomX
Copy link
Author

Hi,
oh well. Thank you for your fast response!
That worked very well!
If i had only taken one minute more to have a look 👍
Best regards!

@ghost
Copy link

ghost commented Mar 18, 2021

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

@ghost
Copy link

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