pulumi / pulumi-azure

A Microsoft Azure Pulumi resource package, providing multi-language access to Azure
Apache License 2.0
134 stars 51 forks source link

Importing CustomHttpsConfiguration resource fails #975

Closed fsodano closed 2 years ago

fsodano commented 2 years ago

Hello!

Issue details

Hi there, I'm trying to replicate an existing FrontDoor to be managed with Pulumi. So far the only workable combination is using both azure classic and azure native.

Azure native for the FrontDoor resource and its subresources Azure classic for the CustomHttpsConfiguration

I'm going to try creating the custom https configuration through code, if that fails it means we can't use Pulumi to manage our FrontDoor; we have spent a long time trying to get it to work so it would be a bummer to not be able to use Pulumi due to this small issue :)

Steps to reproduce

  1. Create a FrontDoor resource
  2. Add a FrontEndEndpoint subresource with CustomHttpsConfiguration
  3. Import it using pulumi import azure:frontdoor/customHttpsConfiguration:CustomHttpsConfiguration.

Expected:

Resource is imported

Actual:

Diagnostics:
  azure:frontdoor:CustomHttpsConfiguration (c1):
    error: Preview failed: diffing urn:pulumi:tmp::Core.FrontDoor::azure:frontdoor/customHttpsConfiguration:CustomHttpsConfiguration::c1: validating Front Door Custom Https Configuration for Endpoint "my-endpoint(Front Door "fd-company"/ Resource Group "rg"): "custom_https_provisioning_enabled" is set to "true". please add a "custom_https_configuration" block to the configuration file
fsodano commented 2 years ago

Just confirming that creating the CustomHttpsConfiguration w/code (not importing it) works fine.

leezen commented 2 years ago

@fsodano Thanks for that additional confirmation. Are you able to import via code as well, then? That might be a workaround for now (https://www.pulumi.com/docs/guides/adopting/import/#pulumi-import-resource-operation)

fsodano commented 2 years ago

Thank you @leezen , I haven't tried as that method required me to create the resource definition from scratch anyways. My use case for using the import was because I wanted to get the current resource definition from an existing resource so I could create another one in a different stack.

mikhailshilkov commented 2 years ago

Import functionality has been significantly refactored in https://github.com/pulumi/pulumi/issues/8922 to substantially reduce the number of failures during pulumi import and make the generated code more truthful and complete. We haven't tested this exact issue, but we believe it's addressed by the refactoring.

I'll go ahead and close the issue - feel free if you still get issues with it after upgrading to the Pulumi CLI version 3.26.1 or above.

Read more about the changes in Easier IaC adoption with improved pulumi import experience.