https://pulumi.com logo
#typescript
Title
# typescript
b

busy-journalist-6936

04/15/2022, 6:56 PM
The end goal is:
Copy code
import * as k from "@pulumi/kubernetes";
const stack = pulumi.getStack();
const name: string = pulumi.concat(["kc2-", stack]);
const ns = new k.core.v1.Namespace(name, {
  metadata: {
      name: name,
    },
}, {
  provider: kubevirt,
});
l

little-cartoon-10569

04/18/2022, 10:14 PM
There is an alternative to `pulumi.concat`: interpolate.
Copy code
import * as k from "@pulumi/kubernetes";
const ns = new k.core.v1.Namespace(name, {
  metadata: {
      name: pulumi.interpolate`$kc2-${pulumi.getStack()}`,
    },
}, {
  provider: kubevirt,
});
Heh, I made the same assumption as you 🙂
getStack()
isn't an output. Still, this solution works for other cases where you are using an output 🙂
1
2 Views