cuddly-leather-18640
10/19/2018, 7:51 PMCannot call '.get' during update or preview
and I think it’s from the following new TS I added to my index.ts:
let apiIntentRobotServiceAccount = new k8s.core.v1.ServiceAccount(
'api-intent-robot-service-account', {
metadata: {
name: 'api-intent-robot',
namespace: context.inferredNamespace
}
}
)
let apiIntentEphemeralRobotRole = new k8s.rbac.v1.Role(
'api-intent-ephemeral-robot-role',
{
metadata: {
name: 'api-intent-robot-role',
namespace: EPHEMERAL_NAMESPACE_NAME
},
rules: [
{
apiGroups: [''],
resources: ['pods', 'pods/status'],
verbs: ['get', 'create', 'patch', 'delete', 'list', 'status']
}
]
}
)
let apiIntentEphemeralRolebinding = new k8s.rbac.v1.RoleBinding(
'api-intent-ephemeral-robot-rolebinding',
{
metadata: {
name: 'api-intent-robot-rolebinding',
namespace: EPHEMERAL_NAMESPACE_NAME
},
roleRef: {
name: apiIntentEphemeralRobotRole.metadata.get().name,
apiGroup: apiIntentEphemeralRobotRole.apiVersion,
kind: apiIntentEphemeralRobotRole.kind
},
subjects: [
{
kind: apiIntentRobotServiceAccount.kind,
name: apiIntentRobotServiceAccount.metadata.get().name,
}
]
})
Am I not allowed to get the name of a resource to use in the spec of another resource?creamy-potato-29402
10/19/2018, 7:54 PMapiIntentRobotServiceAccount.metadata.apply(m => m.name)
get
does something else. .apply
is the method you want.cuddly-leather-18640
10/19/2018, 7:55 PMcreamy-potato-29402
10/19/2018, 7:56 PMcuddly-leather-18640
10/19/2018, 7:56 PMget
doesn’t give me the resourcecreamy-potato-29402
10/19/2018, 7:59 PMwhite-balloon-205
creamy-potato-29402
10/19/2018, 7:59 PMget
should tell you what the method does.pulumi up
before, the preview is going to tell you that it’s going to create those resources.cuddly-leather-18640
10/19/2018, 8:02 PMpreview
isn’t seeing what I’ve already appliedcreamy-potato-29402
10/19/2018, 8:02 PMk8s.core.v1.ServiceAccount.get('api-intent-robot')
to reference resources that already exist.cuddly-leather-18640
10/19/2018, 8:06 PMglamorous-printer-66548
10/20/2018, 1:58 AMapiIntentRobotServiceAccount.metadata.apply(m => m.name)
you can just write:
import { getName} from '@solvvy/pulumi-util';
getName(apiIntentRobotServiceAccount);
🙂