https://pulumi.com logo
Title
d

damp-lamp-30288

12/09/2022, 3:20 AM
Hi 👋 I've run into a very frustrating issue with Pulumi and am in need of assistance. Currently all deployments of this stack are blocked because of this issue. I have a simple update to create a new KMS Key and Key alias that is failing due to
Duplicate resource URN
. However there is no other KMS key in this stack and no duplicate URN. I have exported the stack to JSON and verified that there is no matching URN.
error: Duplicate resource URN 'urn:pulumi:production::jackpot-reader::aws:kms/key:Key::jackpot-reader-production-key'; try giving it a unique name
Even weirder, when I go back to a previous commit (before the KMS key was in the stack) and run a
pulumi preview
, in the diff it shows that it's trying to create the KMS Key! Yet there's no key in the IaC!
...
 +   └─ aws:kms:Key                     jackpot-reader-production-key            create     
 +      └─ aws:kms:Alias                key-alias                                create 
...
Changing the name just creates two keys as well! (one with the new and one with the old)
...
 +   ├─ aws:kms:Key                     jackpot-reader-production-kms-key        create     
 +   │  └─ aws:kms:Alias                jackpot-reader-production-kms-key-alias  create     
 +   ├─ aws:kms:Key                     jackpot-reader-production-key            create     
 +   │  └─ aws:kms:Alias                key-alias                                create    
...
Any help would be appreciated as we are essentially blocked from deploying this stack. Versions:
"@pulumi/aws": "^4.38.0"
"@pulumi/pulumi": "^2.1.0"
We are using TypeScript as well. I've tried updating the AWS package, pulumi package, refreshing the stack but no luck.
l

little-cartoon-10569

12/09/2022, 3:38 AM
Are you running Pulumi from a transpiled directory? That is, running the .js files from ./dist or ./bin, as opposed to running .ts files directly? You might need to clean your outDir.
d

damp-lamp-30288

12/09/2022, 3:39 AM
Nah I'm running via the CLI and have no
./dist
or
./bin
in the working directory
l

little-cartoon-10569

12/09/2022, 3:49 AM
Does your Pulumi.yaml have anything like this?
runtime: 
   name: nodejes
  options:
    typescript: false
And/or: do you have any .js files in your source dir?
Aside: this is question isn't related to the Pulumi service (app.pulumi.com). It is probably a #typescript question?
d

damp-lamp-30288

12/09/2022, 3:54 AM
No nothing out of the ordinary for a Pulumi TypeScript project. I've managed to make a bit of progress, I reverted to an older commit and the Key stopped coming up as a
create
so I've applied that. However I keep getting strange diffs in the stack when I change no IaC. This may be an issue with the AWS pulumi package...
l

little-cartoon-10569

12/09/2022, 4:02 AM
Not one that anyone else has reported, I think? Have you tried a
pulumi refresh
?
d

damp-lamp-30288

12/09/2022, 4:07 AM
Yep I've used
pulumi refresh
, I'm thinking this is an issue with the AWS package. I'm not getting repeatable deploys here, I change no IaC and have diffs between ups where I shouldn't...