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_image: add option to set the hyper_v_generation for the image #4453

Merged
merged 1 commit into from
Dec 17, 2019

Conversation

abhinavdahiya
Copy link
Contributor

@abhinavdahiya abhinavdahiya commented Sep 27, 2019

The new clients require this information see properties.hyperVGeneration and it supports 2 values V1 and V2 2

the default is V1 in azure cli --hyper-v-generation 3, so it should be safe to keep that as default.

Fixes: #4361

@ghost ghost added the size/XS label Sep 27, 2019
@abhinavdahiya
Copy link
Contributor Author

I can't run the make testacc locally because of errors like

--- FAIL: TestAccAzureRMImage_standaloneImageZoneRedundant (428.26s)
    testing.go:569: Step 0 error: errors during apply:

        Error: Code="PlatformImageNotFound" Message="The platform image 'Canonical:UbuntuServer:16.04-LTS:latest' is not available. Verify that all fields in the storage profile are correct."

          on /tmp/tf-test144897292/main.tf line 61:
          (source code not available)


FAIL
FAIL    github.com/terraform-providers/terraform-provider-azurerm/azurerm       428.288s

it would be amazing if if you can help why?

Copy link
Member

@mbfrahry mbfrahry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @abhinavdahiya, these changes look good but we should also try and set this property in the read function if we can. Also, as for the errors you're seeing, it looks like our tests haven't been updated all the way. You can change 16.04-LTS -> 18.04-LTS and Standard_F2 -> Standard_D1_v2. That should allow the initial test to pass. But it also looks like TestAccAzureRMImage_standaloneImageZoneRedundant never passed so let's not worry about getting that to pass. The final thing to do for now would be to also write a test that creates a V2 hyper_v_generation just to make sure it works.

@abhinavdahiya
Copy link
Contributor Author

@mbfrahry update the commit to

A) update the read function to also set the hyper_v_generation

B) Add a testcase TestAccAzureRMImage_standaloneImage_hyperVGeneration_V2
which creates a V2 azure image.

The testsuite before the change is as follows:

make testacc TESTARGS='-run=TestAccAzureRMImage_standaloneImage'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor'|grep -v 'examples') -v -run=TestAccAzureRMImage_standaloneImage -timeout 180m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
?       github.com/terraform-providers/terraform-provider-azurerm       [no test files]

=== RUN   TestAccAzureRMImage_standaloneImage
=== PAUSE TestAccAzureRMImage_standaloneImage
=== RUN   TestAccAzureRMImage_standaloneImageZoneRedundant
=== PAUSE TestAccAzureRMImage_standaloneImageZoneRedundant
=== CONT  TestAccAzureRMImage_standaloneImage
=== CONT  TestAccAzureRMImage_standaloneImageZoneRedundant
--- FAIL: TestAccAzureRMImage_standaloneImageZoneRedundant (486.68s)
    testing.go:569: Step 0 error: errors during apply:

        Error: Code="PlatformImageNotFound" Message="The platform image 'Canonical:UbuntuServer:16.04-LTS:latest' is not available. Verify that all fields in the storage profile are correct."

          on /tmp/tf-test364164823/main.tf line 61:
          (source code not available)

--- FAIL: TestAccAzureRMImage_standaloneImage (1019.63s)
    testing.go:569: Step 1 error: errors during apply:

        Error: compute.ImagesClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidParameter" Message="Required parameter 'hyperVGeneration' is missing (null)." Target="hyperVGeneration"

          on /tmp/tf-test119634721/main.tf line 99:
          (source code not available)

        Error: Code="TargetDiskBlobAlreadyExists" Message="Blob https://accsa191001150912481015.blob.core.windows.net/vhds/myosdisk1.vhd already exists. Please provide a different blob URI as target for disk 'myosdisk1'."

          on /tmp/tf-test119634721/main.tf line 61:
          (source code not available)

FAIL
FAIL    github.com/terraform-providers/terraform-provider-azurerm/azurerm       1019.656s

The test suite after the change is as follows:

make testacc TESTARGS='-run=^TestAccAzureRMImage_standaloneImage'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor'|grep -v 'examples') -v -run=^TestAccAzureRMImage_standaloneImage -timeout 180m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
?       github.com/terraform-providers/terraform-provider-azurerm       [no test files]
=== RUN   TestAccAzureRMImage_standaloneImage
=== PAUSE TestAccAzureRMImage_standaloneImage
=== RUN   TestAccAzureRMImage_standaloneImage_hyperVGeneration_V2
=== PAUSE TestAccAzureRMImage_standaloneImage_hyperVGeneration_V2
=== RUN   TestAccAzureRMImage_standaloneImageZoneRedundant
=== PAUSE TestAccAzureRMImage_standaloneImageZoneRedundant
=== CONT  TestAccAzureRMImage_standaloneImage
=== CONT  TestAccAzureRMImage_standaloneImageZoneRedundant
=== CONT  TestAccAzureRMImage_standaloneImage_hyperVGeneration_V2
--- FAIL: TestAccAzureRMImage_standaloneImageZoneRedundant (362.47s)
    testing.go:569: Step 0 error: errors during apply:

        Error: Code="PlatformImageNotFound" Message="The platform image 'Canonical:UbuntuServer:18.04-LTS:latest' is not available. Verify that all fields in the storage profile are correct."

          on /tmp/tf-test403504907/main.tf line 61:
          (source code not available)

--- PASS: TestAccAzureRMImage_standaloneImage (380.55s)
--- PASS: TestAccAzureRMImage_standaloneImage_hyperVGeneration_V2 (564.15s)
FAIL
FAIL    github.com/terraform-providers/terraform-provider-azurerm/azurerm       564.181s

PTAL

The new clients require this information see [properties.hyperVGeneration][1] and it supports 2 values `V1` and `V2` [2]

the default is `V1` in azure cli `--hyper-v-generation` [3], so it should be safe to keep that as default.

The testsuite before the change is as follows:

make testacc TESTARGS='-run=TestAccAzureRMImage_standaloneImage'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor'|grep -v 'examples') -v -run=TestAccAzureRMImage_standaloneImage -timeout 180m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
?       github.com/terraform-providers/terraform-provider-azurerm       [no test files]

=== RUN   TestAccAzureRMImage_standaloneImage
=== PAUSE TestAccAzureRMImage_standaloneImage
=== RUN   TestAccAzureRMImage_standaloneImageZoneRedundant
=== PAUSE TestAccAzureRMImage_standaloneImageZoneRedundant
=== CONT  TestAccAzureRMImage_standaloneImage
=== CONT  TestAccAzureRMImage_standaloneImageZoneRedundant
--- FAIL: TestAccAzureRMImage_standaloneImageZoneRedundant (486.68s)
    testing.go:569: Step 0 error: errors during apply:

        Error: Code="PlatformImageNotFound" Message="The platform image 'Canonical:UbuntuServer:16.04-LTS:latest' is not available. Verify that all fields in the storage profile are correct."

          on /tmp/tf-test364164823/main.tf line 61:
          (source code not available)

--- FAIL: TestAccAzureRMImage_standaloneImage (1019.63s)
    testing.go:569: Step 1 error: errors during apply:

        Error: compute.ImagesClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidParameter" Message="Required parameter 'hyperVGeneration' is missing (null)." Target="hyperVGeneration"

          on /tmp/tf-test119634721/main.tf line 99:
          (source code not available)

        Error: Code="TargetDiskBlobAlreadyExists" Message="Blob https://accsa191001150912481015.blob.core.windows.net/vhds/myosdisk1.vhd already exists. Please provide a different blob URI as target for disk 'myosdisk1'."

          on /tmp/tf-test119634721/main.tf line 61:
          (source code not available)

FAIL
FAIL    github.com/terraform-providers/terraform-provider-azurerm/azurerm       1019.656s
```

The test suite after the change is as follows:

```console
make testacc TESTARGS='-run=^TestAccAzureRMImage_standaloneImage'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor'|grep -v 'examples') -v -run=^TestAccAzureRMImage_standaloneImage -timeout 180m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
?       github.com/terraform-providers/terraform-provider-azurerm       [no test files]
=== RUN   TestAccAzureRMImage_standaloneImage
=== PAUSE TestAccAzureRMImage_standaloneImage
=== RUN   TestAccAzureRMImage_standaloneImage_hyperVGeneration_V2
=== PAUSE TestAccAzureRMImage_standaloneImage_hyperVGeneration_V2
=== RUN   TestAccAzureRMImage_standaloneImageZoneRedundant
=== PAUSE TestAccAzureRMImage_standaloneImageZoneRedundant
=== CONT  TestAccAzureRMImage_standaloneImage
=== CONT  TestAccAzureRMImage_standaloneImageZoneRedundant
=== CONT  TestAccAzureRMImage_standaloneImage_hyperVGeneration_V2
--- FAIL: TestAccAzureRMImage_standaloneImageZoneRedundant (362.47s)
    testing.go:569: Step 0 error: errors during apply:

        Error: Code="PlatformImageNotFound" Message="The platform image 'Canonical:UbuntuServer:18.04-LTS:latest' is not available. Verify that all fields in the storage profile are correct."

          on /tmp/tf-test403504907/main.tf line 61:
          (source code not available)

--- PASS: TestAccAzureRMImage_standaloneImage (380.55s)
--- PASS: TestAccAzureRMImage_standaloneImage_hyperVGeneration_V2 (564.15s)
FAIL
FAIL    github.com/terraform-providers/terraform-provider-azurerm/azurerm       564.181s
```

[1]: https://docs.microsoft.com/en-us/rest/api/compute/images/createorupdate#image
[2]: https://docs.microsoft.com/en-us/rest/api/compute/images/createorupdate#hypervgenerationtypes
[3]: https://docs.microsoft.com/en-us/cli/azure/image?view=azure-cli-latest#optional-parameters
@abhinavdahiya
Copy link
Contributor Author

@tombuildsstuff any update on when this fix can merge.

abhinavdahiya added a commit to abhinavdahiya/installer that referenced this pull request Oct 8, 2019
…ndle private_dns zone

Using the upstream azurerm provider is not possible for now because of following reasons:

1) There is not srv record resource for private dns zone

2) The version of provider that has the private dns zone resources `1.34.0` has a lot of bugs like
    * hashicorp/terraform-provider-azurerm#4452
    * hashicorp/terraform-provider-azurerm#4453
    * hashicorp/terraform-provider-azurerm#4501
    Some of these bugs are fixed, and some are in flight.

    Another reason moving to `1.36.0` which might have all the fixes we need is the provider has moved to using
    `standalone terraform plugin SDK v1.1.1` [1]. Because we vendor both terraform and providers, this causes errors like
    `panic: gob: registering duplicate types for "github.com/zclconf/go-cty/cty.primitiveType": cty.primitiveType != cty.primitiveType`

   Therefore, we would have to move towards a single vendor for terraform and plugins for correct inter-operation, which is tricker due to conflicts elsewhere

A simple 4 resource plugin that re-uses the already vendored azurerm provider as library and carries over the required resources seems like an easy fix for now.

[1]: hashicorp/terraform-provider-azurerm#4474
abhinavdahiya added a commit to abhinavdahiya/installer that referenced this pull request Oct 8, 2019
…ndle private_dns zone

Using the upstream azurerm provider is not possible for now because of following reasons:

1) There is not srv record resource for private dns zone

2) The version of provider that has the private dns zone resources `1.34.0` has a lot of bugs like
    * hashicorp/terraform-provider-azurerm#4452
    * hashicorp/terraform-provider-azurerm#4453
    * hashicorp/terraform-provider-azurerm#4501
    Some of these bugs are fixed, and some are in flight.

    Another reason moving to `1.36.0` which might have all the fixes we need is the provider has moved to using
    `standalone terraform plugin SDK v1.1.1` [1]. Because we vendor both terraform and providers, this causes errors like
    `panic: gob: registering duplicate types for "github.com/zclconf/go-cty/cty.primitiveType": cty.primitiveType != cty.primitiveType`

   Therefore, we would have to move towards a single vendor for terraform and plugins for correct inter-operation, which is tricker due to conflicts elsewhere

A simple 4 resource plugin that re-uses the already vendored azurerm provider as library and carries over the required resources seems like an easy fix for now.

[1]: hashicorp/terraform-provider-azurerm#4474
abhinavdahiya added a commit to abhinavdahiya/installer that referenced this pull request Oct 8, 2019
…ndle private_dns zone

Using the upstream azurerm provider is not possible for now because of following reasons:

1) There is not srv record resource for private dns zone

2) The version of provider that has the private dns zone resources `1.34.0` has a lot of bugs like
    * hashicorp/terraform-provider-azurerm#4452
    * hashicorp/terraform-provider-azurerm#4453
    * hashicorp/terraform-provider-azurerm#4501
    Some of these bugs are fixed, and some are in flight.

    Another reason moving to `1.36.0` which might have all the fixes we need is the provider has moved to using
    `standalone terraform plugin SDK v1.1.1` [1]. Because we vendor both terraform and providers, this causes errors like
    `panic: gob: registering duplicate types for "github.com/zclconf/go-cty/cty.primitiveType": cty.primitiveType != cty.primitiveType`

   Therefore, we would have to move towards a single vendor for terraform and plugins for correct inter-operation, which is tricker due to conflicts elsewhere

A simple 4 resource plugin that re-uses the already vendored azurerm provider as library and carries over the required resources seems like an easy fix for now.

[1]: hashicorp/terraform-provider-azurerm#4474
abhinavdahiya added a commit to abhinavdahiya/installer that referenced this pull request Oct 8, 2019
…ndle private_dns zone

Using the upstream azurerm provider is not possible for now because of following reasons:

1) There is not srv record resource for private dns zone

2) The version of provider that has the private dns zone resources `1.34.0` has a lot of bugs like
    * hashicorp/terraform-provider-azurerm#4452
    * hashicorp/terraform-provider-azurerm#4453
    * hashicorp/terraform-provider-azurerm#4501
    Some of these bugs are fixed, and some are in flight.

    Another reason moving to `1.36.0` which might have all the fixes we need is the provider has moved to using
    `standalone terraform plugin SDK v1.1.1` [1]. Because we vendor both terraform and providers, this causes errors like
    `panic: gob: registering duplicate types for "github.com/zclconf/go-cty/cty.primitiveType": cty.primitiveType != cty.primitiveType`

   Therefore, we would have to move towards a single vendor for terraform and plugins for correct inter-operation, which is tricker due to conflicts elsewhere

A simple 4 resource plugin that re-uses the already vendored azurerm provider as library and carries over the required resources seems like an easy fix for now.

[1]: hashicorp/terraform-provider-azurerm#4474
@tombuildsstuff tombuildsstuff modified the milestones: v1.36.0, v1.37.0 Oct 28, 2019
@tombuildsstuff tombuildsstuff removed their assignment Oct 31, 2019
alaypatel07 pushed a commit to alaypatel07/installer that referenced this pull request Nov 13, 2019
…ndle private_dns zone

Using the upstream azurerm provider is not possible for now because of following reasons:

1) There is not srv record resource for private dns zone

2) The version of provider that has the private dns zone resources `1.34.0` has a lot of bugs like
    * hashicorp/terraform-provider-azurerm#4452
    * hashicorp/terraform-provider-azurerm#4453
    * hashicorp/terraform-provider-azurerm#4501
    Some of these bugs are fixed, and some are in flight.

    Another reason moving to `1.36.0` which might have all the fixes we need is the provider has moved to using
    `standalone terraform plugin SDK v1.1.1` [1]. Because we vendor both terraform and providers, this causes errors like
    `panic: gob: registering duplicate types for "github.com/zclconf/go-cty/cty.primitiveType": cty.primitiveType != cty.primitiveType`

   Therefore, we would have to move towards a single vendor for terraform and plugins for correct inter-operation, which is tricker due to conflicts elsewhere

A simple 4 resource plugin that re-uses the already vendored azurerm provider as library and carries over the required resources seems like an easy fix for now.

[1]: hashicorp/terraform-provider-azurerm#4474
jhixson74 pushed a commit to jhixson74/installer that referenced this pull request Dec 6, 2019
…ndle private_dns zone

Using the upstream azurerm provider is not possible for now because of following reasons:

1) There is not srv record resource for private dns zone

2) The version of provider that has the private dns zone resources `1.34.0` has a lot of bugs like
    * hashicorp/terraform-provider-azurerm#4452
    * hashicorp/terraform-provider-azurerm#4453
    * hashicorp/terraform-provider-azurerm#4501
    Some of these bugs are fixed, and some are in flight.

    Another reason moving to `1.36.0` which might have all the fixes we need is the provider has moved to using
    `standalone terraform plugin SDK v1.1.1` [1]. Because we vendor both terraform and providers, this causes errors like
    `panic: gob: registering duplicate types for "github.com/zclconf/go-cty/cty.primitiveType": cty.primitiveType != cty.primitiveType`

   Therefore, we would have to move towards a single vendor for terraform and plugins for correct inter-operation, which is tricker due to conflicts elsewhere

A simple 4 resource plugin that re-uses the already vendored azurerm provider as library and carries over the required resources seems like an easy fix for now.

[1]: hashicorp/terraform-provider-azurerm#4474
jhixson74 pushed a commit to jhixson74/installer that referenced this pull request Dec 16, 2019
…ndle private_dns zone

Using the upstream azurerm provider is not possible for now because of following reasons:

1) There is not srv record resource for private dns zone

2) The version of provider that has the private dns zone resources `1.34.0` has a lot of bugs like
    * hashicorp/terraform-provider-azurerm#4452
    * hashicorp/terraform-provider-azurerm#4453
    * hashicorp/terraform-provider-azurerm#4501
    Some of these bugs are fixed, and some are in flight.

    Another reason moving to `1.36.0` which might have all the fixes we need is the provider has moved to using
    `standalone terraform plugin SDK v1.1.1` [1]. Because we vendor both terraform and providers, this causes errors like
    `panic: gob: registering duplicate types for "github.com/zclconf/go-cty/cty.primitiveType": cty.primitiveType != cty.primitiveType`

   Therefore, we would have to move towards a single vendor for terraform and plugins for correct inter-operation, which is tricker due to conflicts elsewhere

A simple 4 resource plugin that re-uses the already vendored azurerm provider as library and carries over the required resources seems like an easy fix for now.

[1]: hashicorp/terraform-provider-azurerm#4474

(cherry picked from commit af00810)
@abhinavdahiya
Copy link
Contributor Author

Any I can do to get this moving forward, or is there anything that's blocking this @mbfrahry @tombuildsstuff ?

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @abhinavdahiya

Thanks for pushing those changes - apologies for the delayed review here!

Taking a look through this LGTM 👍

Thanks!

@tombuildsstuff tombuildsstuff dismissed mbfrahry’s stale review December 17, 2019 15:49

dismissing since changes have been pushed

@tombuildsstuff
Copy link
Contributor

Ignoring some known/existing test failures, this LGTM:

Screenshot 2019-12-17 at 16 49 55

@tombuildsstuff tombuildsstuff merged commit 3baba3e into hashicorp:master Dec 17, 2019
@tombuildsstuff tombuildsstuff added this to the v1.40.0 milestone Dec 17, 2019
tombuildsstuff added a commit that referenced this pull request Dec 17, 2019
@ghost
Copy link

ghost commented Jan 8, 2020

This has been released in version 1.40.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 = "~> 1.40.0"
}
# ... other configuration ...

@ghost
Copy link

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

Successfully merging this pull request may close these issues.

azurerm provider 1.34 failds to deploy vm with image copy from blob
3 participants