10 karma · joined Feb 13, 2019 (7y ago) · 5 submissions
comment 6y ago · link · parent
comment 6y ago · link · parent
Here’s the annotation:
cloud.google.com/neg-status: '{"network_endpoint_groups":{"443":"k8s1-5487ae62-istio-system-istio-ingressgateway-443-811432aa"},"zones":["us-east1-d"]}'
And here’s the Pulumi code snippet in TypeScript required to parse it. // This defines a callback that runs once the Service is provisioned.
const neg_status = svc.metadata.annotations.apply(x => {
const status = x['cloud.google.com/neg-status'];
const obj = JSON.parse(status);
return obj["network_endpoint_groups"]["443"]
});
// Using the computed value from the callback to dynamically retrieve another value.
const neg = gcp.compute.getNetworkEndpointGroup({
name: neg_status,
zone: "us-east1-d"
});comment 6y ago · link · parent
The Pulumi engine uses a desired state model[1]. You can use imperative language features like loops and conditionals, but all of that gets mapped to a declarative resource graph prior to diffs/updates.
[1] https://www.pulumi.com/docs/intro/concepts/how-pulumi-works/