https://pulumi.com logo
Title
f

full-portugal-31925

02/14/2023, 12:48 PM
Hi! I'm trying to adopt Pulumi for existing Azure resources but I just can't get rid of default values. If I create a new
StorageAccount
from scratch, like below, everything is awesome:
var testStorage = new StorageAccount("test-storage", new()
{
   ResourceGroupName = "my-resource-group",
   AccountName = "test-storage-01",
   Kind = Kind.StorageV2,
   Sku = new SkuArgs { Name = SkuName.Standard_GRS }
});
Now after having imported an identical
StorageAccount
that already exists in Azure, I just can't get rid of the default properties. I tried remove default values (no luck), then using
pulumi refresh
(no luck), then editing state manually (through export/import, ensuring both accounts look exactly the same) but I can't make Pulumi think the StorageAccount is ok. When deploying, it keeps telling me there's a diff:
- accessTier            : <null>
      - allowBlobPublicAccess : <null>
      - allowSharedKeyAccess  : <null>
      - enableHttpsTrafficOnly: <null>
      - enableNfsV3           : <null>
      - encryption            : <null>
      - identity              : <null>
      - isHnsEnabled          : <null>
      - networkRuleSet        : <null>
and this is no in-place update. Pulumi wants to replace the existing resource with a new one, which I don't want/can't do. Any idea?
s

stocky-restaurant-98004

02/14/2023, 2:48 PM
Is this in the Native provider or Classic provider?
In any case, this sounds like a bug. Can you submit a GH issue in the relevant repo? LMK if you're having trouble.
f

full-portugal-31925

02/14/2023, 4:53 PM
Native
I'm not sure how to open a bug? The AZ infra itself is private, I could share the C# code with you and maybe the state but I'd need to anonymise some names.
One thing that confuses me is: what is the source of truth that Pulumi uses to compute the diff? I thought it was the
.json
state file + the result of running C# code, but as far as I can tell both are identical for the newly created and imported resources. So for the same inputs I'd expect the same outcome?? I have to assume that there's another input? Does the Native Azure provider query the cloud to get additional data on existing resources? I could imagine there might be differences here (although
az group list
are very similar as well).
s

stocky-restaurant-98004

02/14/2023, 8:31 PM
Feel free to anonymize as much as you need to, but a minimal program to repro is ideal. https://github.com/pulumi/pulumi-azure-native
If there's indeed a bug, it probably affects any import of that resource type.
f

full-portugal-31925

02/15/2023, 3:31 PM
See if you can figure out something from this: https://github.com/pulumi/pulumi-azure-native/issues/2246