I'm trying to access a deeply nested resource valu...
# typescript
o
I'm trying to access a deeply nested resource value. Specifically, the ingressNginx LoadBalancer IP. Structure is shown below. Suggestions on the proper syntactic magic to get there? Or an alternate means to acquire this info?
Copy code
- ingressNginx : {
      - resources: {
          - v1/Service::infra-92vjemsb/ingress-nginx-controller                                    : {
              - apiVersion: "v1"
              - id        : "infra-92vjemsb/ingress-nginx-controller"
              - kind      : "Service"
              - status    : {
                  - loadBalancer: {
                      - ingress: [
                      -     [0]: {
                              - ip: "20.112.55.186"
                        } ]
    }   }   }   }   }
h
Hi, I think you should be able to use the 'lifting' behavior to access these properties directly in your typescript. If each property is itself an output, then you can still access sub-properties without verbose checking. Accessing output properties is a little like implicitly having the
?.
syntax. Here's the example in the docs:
Copy code
let certValidation = new aws.route53.Record("cert_validation", {
  records: [certCertificate.domainValidationOptions[0].resourceRecordValue],

// instead of

let certValidation = new aws.route53.Record("cert_validation", {
  records: [certCertificate.apply(cc => cc ? cc.domainValidationOptions : undefined)
                           .apply(dvo => dvo ? dvo[0] : undefined)
                           .apply(o => o ? o.resourceRecordValue : undefined)],