https://pulumi.com logo
#google-cloud
Title
# google-cloud
s

steep-caravan-65104

03/06/2020, 7:29 AM
For some reason, with some GCP keys, if I export values with double quotes in
index.ts
, then
pulumi up
shows the expected behaviour. However, if I change the double quotes to single quotes, then GCP keys from one of the imported files are prompted for deletion. This looks like a pulumi bug. Please let me know if you need any additional details, I can file a github issue or provide more details in private chat.
cluster.ts
Copy code
import * as gcp from "@pulumi/gcp";
import { config } from "./config";
import { regionalKeyring } from "./keyrings";

export const experimentsregionalClusterKey = new gcp.kms.CryptoKey(
  config.regionalClusterKey,
  {
    keyRing: regionalKeyring.selfLink,
    rotationPeriod: "31556952s",
    name: config.regionalClusterKey,
    purpose: "ENCRYPT_DECRYPT"
  },
  {
    protect: true
  }
);

export const regionalClusterKeyEDPerms = new gcp.kms.CryptoKeyIAMBinding(
    config.regionalClusterKeyEDPermsName,
    {
    cryptoKeyId: `${config.gcpProject}/${config.gcpRegion}/${config.regionalKeyring}/${config.regionalClusterKey}`,
    members: [config.k8sServiceAgent],
    role: "roles/cloudkms.cryptoKeyEncrypterDecrypter"
    }
);
index.ts
with single quotes in the
export
statements. This prompts for deletion of the key and permissions imported from the
cluster.ts
file above when performing
pulumi up
Copy code
export * from './pulumi'
export * from './cluster'
export * from './cloudbuild'


export * from './apps/zzz'
pulumi up
output with this file. The deletion fails in preview as the key is protected.
Copy code
gcp:kms:CryptoKey             <regional-cluster-key-name>  delete      1 error
index.ts
with double quotes in the
export
statements. This does NOT prompt for deletion of any resources which is the expected behaviour.
Copy code
export * from "./pulumi";
export * from "./cluster";
export * from "./cloudbuild";


export * from "./apps/zzz";
w

white-balloon-205

03/07/2020, 6:16 PM
It should not be possible for “ vs ‘ to matter here - they are treated the same by NodeJS. If you are seeing prompts for deletion, it is because you program is not loading some of the files. Note that TypeScript will in some cases not import a library at runtime if there are no values exported from it. That is the most likely cause here?
g

glamorous-printer-66548

03/08/2020, 12:20 AM
Not sure if you omitting the semicolons in the first case alters typescript's module loading behaviour somehow.
s

steep-caravan-65104

03/09/2020, 3:57 AM
Thanks for the inputs guys. Not sure now as I can't reproduce this anymore even with the first version for some reason.
2 Views