https://pulumi.com logo
#general
Title
# general
l

little-garage-43399

09/17/2019, 9:37 PM
I have some files uploads after deployment (ssh), and they run twice, on preview and the actual run. How can I make the code run only on provisioning?
b

busy-umbrella-36067

09/17/2019, 10:03 PM
I think you can use
if (!pulumi.runtime.isDryRun()) {}
for that
☝️ 1
I do something similar for EKS clusters
Copy code
// add annotation to default namespace
    if (!isDryRun()) {
      cluster.kubeconfig.apply(async kubeconfig => {
        await new Promise(resolve => fs.writeFile(`/tmp/${name}-kubeconfig.yml`, JSON.stringify(kubeconfig), resolve))
        await child_process.exec(
          `kubectl --kubeconfig=/tmp/${name}-kubeconfig.yml annotate ns default <http://iam.amazonaws.com/permitted=%22.*%22|iam.amazonaws.com/permitted=".*"> --overwrite`
        )
      })
    }
l

little-garage-43399

09/24/2019, 11:01 AM
thank you