pulumi / pulumi-azuread

A Microsoft Azure Active Directory (Azure AD) Pulumi resource package, providing multi-language access to Azure AD
Apache License 2.0
18 stars 8 forks source link

Upgrade from 4.x to 5.x causes Unknown kind bool error on applications #1338

Closed gpduck closed 1 month ago

gpduck commented 1 month ago

Describe what happened

'application' resources cause pulumi to crash when upgrading from the 4.x to 5.x @pulumi/azuread provider. There are several properties in state that changed types and the provider is not correctly migrating state. This does not happen in the corresponding terraform provider.

Sample program

npm i @pulumi/azuread@4.x
import { Application } from '@pulumi/azuread';

new Application('app', {
    displayName: 'DuckTestPulumi',
});
npm i @pulumi/azuread@5.x

terraform going from 1.6.0 to 2.53.0 correctly migrates the state and does not produce an error

terraform {
  required_providers {
    azuread = {
      source = "hashicorp/azuread"
      version = "1.6.0"
    }
  }
}

provider "azuread" {
  # Configuration options
  tenant_id = "#####"
}

resource "azuread_application" "ducktest" {
  display_name = "DuckTestTerraform"
}

Log output

No response

Affected Resource(s)

application

Output of pulumi about

CLI
Version      3.119.0
Go Version   go1.22.3
Go Compiler  gc

Plugins
KIND      NAME     VERSION
resource  azuread  5.53.3
language  nodejs   unknown

Host
OS       Microsoft Windows 10 Enterprise
Version  10.0.19045 Build 19045
Arch     x86_64

This project is written in nodejs: executable='C:\Program Files\nodejs\node.exe' version='v22.4.1'

Current Stack: aad/dev

TYPE                                   URN
pulumi:pulumi:Stack                    urn:pulumi:dev::aad::pulumi:pulumi:Stack::aad-dev
pulumi:providers:azuread               urn:pulumi:dev::aad::pulumi:providers:azuread::default_4_3_0
azuread:index/application:Application  urn:pulumi:dev::aad::azuread:index/application:Application::app

Found no pending operations associated with dev

Backend
Name           pulumi.com
Token type     personal

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

thomas11 commented 1 month ago

Thank you for reporting this, @gpduck. I can reproduce it, even when upgrading to v5.0.x first.

    I0923 12:51:20.463309   84468 schema.go:324] Terraform input required_resource_access = []interface {}(nil)
    I0923 12:51:20.463311   84468 schema.go:324] Terraform input type = "webapp/api"
    I0923 12:51:20.463313   84468 schema.go:324] Terraform input public_client = []interface {}{false}
    panic: Unknown kind: bool
    goroutine 52 [running]:
    github.com/hashicorp/terraform-plugin-sdk/v2/terraform.(*ResourceConfig).get(0x1400035d4a0, 0x1400060cd40, 0x1f, 0x1400035d0e0, 0x1f, 0x104588a68, 0x20)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/terraform/resource.go:313 +0x88c
    github.com/hashicorp/terraform-plugin-sdk/v2/terraform.(*ResourceConfig).IsComputed(0x1400035d4a0, 0x1400060cd40, 0x1f, 0x103669ee0)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/terraform/resource.go:226 +0x40
    github.com/hashicorp/terraform-plugin-sdk/v2/terraform.(*ResourceConfig).Get(0x1400035d4a0, 0x1400060cd40, 0x1f, 0xd, 0x14000277b58, 0x1027bc601)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/terraform/resource.go:206 +0x40
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readPrimitive(0x1400035d500, 0x1400060cd40, 0x1f, 0x140009a7540, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1026e23bc, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader_config.go:223 +0x48
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readField(0x1400035d500, 0x1400069ff40, 0x4, 0x4, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader_config.go:101 +0x4c8
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*nestedConfigFieldReader).ReadField(0x1400071a3d8, 0x1400069ff40, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x103726b00, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader_config.go:327 +0x64
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.readListField(0x1038b5de8, 0x1400071a3d8, 0x1400035dd40, 0x3, 0x3, 0x14000287180, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader.go:180 +0xd4
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readSet(0x1400035d500, 0x1400035dd40, 0x3, 0x3, 0x14000287180, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader_config.go:261 +0xd0
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readField(0x1400035d500, 0x1400035dd40, 0x3, 0x3, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader_config.go:107 +0x688
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*nestedConfigFieldReader).ReadField(0x1400071a3d0, 0x1400035dd40, 0x3, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x14000996a50, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader_config.go:327 +0x64
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.readObjectField(0x1038b5de8, 0x1400071a3d0, 0x14000373100, 0x2, 0x2, 0x1400059a690, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader.go:236 +0x170
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readField(0x1400035d500, 0x14000373100, 0x2, 0x2, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader_config.go:109 +0x5d8
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*nestedConfigFieldReader).ReadField(0x1400071a3c0, 0x14000373100, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader_config.go:327 +0x64
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.readListField(0x1038b5de8, 0x1400071a3c0, 0x14000679408, 0x1, 0x1, 0x140002872c0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader.go:203 +0x270
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).readField(0x1400035d500, 0x14000679408, 0x1, 0x1, 0x1400004a900, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader_config.go:103 +0x428
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ConfigFieldReader).ReadField(0x1400035d500, 0x14000679408, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/terraform-plugin-sdk/v2@v2.0.0-20201218231525-9cca98608a5e/helper/schema/field_reader_config.go:29 +0x80
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2.v2Resource.InstanceState(0x140000d3b00, 0x1400004a990, 0x24, 0x1400035d0e0, 0x1400035d080, 0x0, 0x0, 0x1400035d0e0, 0x0)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.4.1-0.20210714215802-5020116ac4e6/pkg/tfshim/sdk-v2/resource.go:97 +0x178
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.MakeTerraformState(0x140000e5c80, 0x1038df7d8, 0x140000d3b00, 0x10333b235, 0x13, 0x1400004a990, 0x24, 0x1400035cc90, 0x10026cc01, 0x1, ...)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.4.1-0.20210714215802-5020116ac4e6/pkg/tfbridge/schema.go:847 +0x1a0
    github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge.(*Provider).Diff(0x140003605a0, 0x1038d4628, 0x1400035cc00, 0x1400037a4d0, 0x140003605a0, 0x103670be0, 0x14000679898)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.4.1-0.20210714215802-5020116ac4e6/pkg/tfbridge/provider.go:730 +0x358
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Diff_Handler.func1(0x1038d4628, 0x1400035cc00, 0x103808c40, 0x1400037a4d0, 0x103816e60, 0x10412e808, 0x1038d4628, 0x1400035cc00)
        /home/runner/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.6.2-0.20210712183851-30278f8e4c08/proto/go/provider.pb.go:2576 +0x7c
    github.com/grpc-ecosystem/grpc-opentracing/go/otgrpc.OpenTracingServerInterceptor.func1(0x1038d4628, 0x1400035c930, 0x103808c40, 0x1400037a4d0, 0x140003721a0, 0x14000554438, 0x0, 0x0, 0x1038b5028, 0x140007197b0)
        /home/runner/go/pkg/mod/github.com/grpc-ecosystem/grpc-opentracing@v0.0.0-20180507213350-8e809c8a8645/go/otgrpc/server.go:57 +0x260
    github.com/pulumi/pulumi/sdk/v3/proto/go._ResourceProvider_Diff_Handler(0x10385c6a0, 0x140003605a0, 0x1038d4628, 0x1400035c930, 0x14000378600, 0x14000515580, 0x1038d4628, 0x1400035c930, 0x140001e7b00, 0x8a1)
thomas11 commented 1 month ago

Hi @gpduck, I believe this issue is already fixed in the latest v5.53.4 of pulumi-azuread. You missed by just one patch version.

Your example fails for me as described on 5.53.3 but succeeds on 5.53.4.

gpduck commented 1 month ago

Yes it does appear to be fixed in 5.53.4. Thanks for looking in to it and getting the issue fixed!