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

proud-pizza-80589

10/11/2021, 4:52 PM
i think you need apply(). containerDefinitions: service.arn.apply((arn) => JSON.stringify({…. value: arn … })
b

brave-nightfall-19158

10/11/2021, 5:46 PM
Hey @proud-pizza-80589 thanks so much! I actually got there in the end and figured out the apply thing so thanks for the pointer - it was exactly right. I'm a bit concerned having started the journey though ... I thought Pulumi would be able to reference resources, now I'm concerned I'll need to do this everytime I need to reference resources between eachother, e.g. subnets. Surely this isn't the case? Are there specific times when apply MUST be called?
p

proud-pizza-80589

10/11/2021, 7:32 PM
only if you want to use stuff as strings
e.g. here, i can use the namespace name right from the Pulumi Output
Copy code
this.internalService = new k8s.core.v1.Service(
      name,
      {
        metadata: {
          labels: compileLabels(subject, SmartContractSet.name),
          namespace: namespace.metadata.name,
        },
        spec: {
          ports: [
            {
              port: 8080,
              name: 'http',
              protocol: 'TCP',
              targetPort: 'http',
            },
          ],
          selector: compileSelectorLabels(subject),
          type: 'ClusterIP',
        },
      },
      { parent: this, provider: opts.provider }
    );
there is a section about this in the docs which explains when and why it needs apply