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

InvalidApiVersionParameter - azurerm_managed_disk #223

Closed
kenlukas opened this issue Aug 8, 2017 · 5 comments
Closed

InvalidApiVersionParameter - azurerm_managed_disk #223

kenlukas opened this issue Aug 8, 2017 · 5 comments
Labels

Comments

@kenlukas
Copy link

kenlukas commented Aug 8, 2017

Terraform Version

Terraform v0.10.0

Affected Resource(s)

Please list the resources as a list, for example:

  • azurerm_managed_disk

Debug Output

  • module.vnet.azurerm_managed_disk.jump_server_disk: 1 error(s) occurred:

  • azurerm_managed_disk.jump_server_disk: disk.DisksClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidApiVersionParameter" Message="The api-version '2016-04-30-preview' is invalid. The supported versions are '2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."

Expected Behavior

Disk should have been created

Actual Behavior

Failure with Status code 400 - InvalidApiVersionParameter

Steps to Reproduce

  1. terraform apply

Important Factoids

Here's the code snippet that's failing

resource "azurerm_managed_disk" "jump_server_disk" {
  name                 = "jump_server_storage"
  location             = "${var.location}"
  resource_group_name  = "${azurerm_resource_group.default.id}"
  storage_account_type = "Standard_LRS"
  create_option        = "Empty"
  disk_size_gb         = "20"
}

References

This appears to be similar to the following:

@tombuildsstuff
Copy link
Contributor

Hey @kenlukas

Thanks for opening this issue :)

So that we can take a look into this - would it be possible to know which Azure region you saw this error in? In addition, are there any specific configurations about the account you're using? (For instance: is the user you're using restricted in any way / what permissions does it have on the Subscription?)

Thanks!

@kenlukas
Copy link
Author

kenlukas commented Aug 9, 2017

Hi @tombuildsstuff
The region is 'East US'
I'm using a Service Principal that has the out of the box 'Contributor' role.

As an fyi, the os disk gets created without issue by the azurerm_virtual_machine resource.

Thanks!

@tombuildsstuff
Copy link
Contributor

@kenlukas awesome, thanks!

So I've been able to reproduce this - the issue is in the Terraform configuration posted above, the Resource Group Name is actually it's ID (not a name), which causes an error at Azure's end.

For instance, here's a full config:

resource "azurerm_resource_group" "test" {
  name = "tharvey-dev"
  location = "eastus"
}

resource "azurerm_managed_disk" "jump_server_disk" {
  name                 = "jump_server_storage"
  location             = "${azurerm_resource_group.test.location}"
  resource_group_name  = "${azurerm_resource_group.test.id}"
  storage_account_type = "Standard_LRS"
  create_option        = "Empty"
  disk_size_gb         = "20"
}

which returns the error you're seeing:

disk.DisksClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="InvalidApiVersionParameter" Message="The api-version '2016-04-30-preview' is invalid. The supported versions are '2017-06-01,2017-05-10,2017-05-01,2017-03-01,2016-09-01,2016-07-01,2016-06-01,2016-02-01,2015-11-01,2015-01-01,2014-04-01-preview,2014-04-01,2014-01-01,2013-03-01,2014-02-26,2014-04'."

When updating the resource_group_name from the name to the id this works as expected:

resource "azurerm_resource_group" "test" {
  name = "tharvey-dev"
  location = "eastus"
}

resource "azurerm_managed_disk" "jump_server_disk" {
  name                 = "jump_server_storage"
  location             = "${azurerm_resource_group.test.location}"
  resource_group_name  = "${azurerm_resource_group.test.name}"
  storage_account_type = "Standard_LRS"
  create_option        = "Empty"
  disk_size_gb         = "20"
}

Would it be possible for you to try updating your config? We should probably be catching this as part of the validation (and I'll open a separate issue for that) - but this should solve the issue :)

Thanks!

@kenlukas
Copy link
Author

kenlukas commented Aug 9, 2017

Hi @tombuildsstuff ,

That worked. Thanks for your help.

-Ken

@ghost
Copy link

ghost commented Apr 1, 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 👉 hashibot-feedback@hashicorp.com. Thanks!

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

No branches or pull requests

2 participants