the examples for AWS certification validations <ht...
# general
l
the examples for AWS certification validations https://www.pulumi.com/registry/packages/aws/api-docs/acm/certificatevalidation/ assume that only a single domain validation output is returned; however in practice AWS can return more than 1 (as described by https://pkg.go.dev/github.com/pulumi/pulumi-aws/sdk/v5/go/aws/acm#CertificateOutput.DomainValidationOptions) . so the example code here should be ranging over all of the outputs rather than assume there is only 1. I can't figure out how to get the length of the array without crashing. Example code is:
Copy code
domainValidationOption := exampleCertificate.DomainValidationOptions.ApplyT(func(options []acm.CertificateDomainValidationOption) interface{} {
            return options[0]
        })
Copy code
^ DomainValidationOptions type is CertificateDomainValidationOptionArrayOutput which has an Index() method but not an associated Len() method. If I use Index() that exceeds the length of the array I get a pulumi crash:

    goroutine 163 [running]:
    <http://github.com/pulumi/pulumi-aws/sdk/v5/go/aws/acm.CertificateDomainValidationOptionArrayOutput.Index.func1({0xc000068da0|github.com/pulumi/pulumi-aws/sdk/v5/go/aws/acm.CertificateDomainValidationOptionArrayOutput.Index.func1({0xc000068da0>?, 0xc000052710?, 0x1?})
        /tmp/7bdd55732174400744/vendor/github.com/pulumi/pulumi-aws/sdk/v5/go/aws/acm/pulumiTypes.go:133 +0x8e
    reflect.Value.call({0x123aa40?, 0x1675698?, 0x40efe5?}, {0x160ba84, 0x4}, {0xc000640648, 0x1, 0xc000452480?})
        /snap/go/9952/src/reflect/value.go:556 +0x845
    reflect.Value.Call({0x123aa40?, 0x1675698?, 0x4a75bc?}, {0xc000640648, 0x1, 0x1})
        /snap/go/9952/src/reflect/value.go:339 +0xbf
    <http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.makeContextful.func1(|github.com/pulumi/pulumi/sdk/v3/go/pulumi.makeContextful.func1(>{0xc000640630?, 0x5?, 0x8?})
        /tmp/7bdd55732174400744/vendor/github.com/pulumi/pulumi/sdk/v3/go/pulumi/types.go:384 +0x56
    reflect.Value.call({0xc000401920?, 0xc00028a9c0?, 0x0?}, {0x160ba84, 0x4}, {0xc000404fa0, 0x2, 0x0?})
        /snap/go/9952/src/reflect/value.go:556 +0x845
    reflect.Value.Call({0xc000401920?, 0xc00028a9c0?, 0xc000122000?}, {0xc000404fa0, 0x2, 0x2})
        /snap/go/9952/src/reflect/value.go:339 +0xbf
    <http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*OutputState).ApplyTWithContext.func1()|github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*OutputState).ApplyTWithContext.func1()>
        /tmp/7bdd55732174400744/vendor/github.com/pulumi/pulumi/sdk/v3/go/pulumi/types.go:507 +0x2f0
    created by <http://github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*OutputState).ApplyTWithContext|github.com/pulumi/pulumi/sdk/v3/go/pulumi.(*OutputState).ApplyTWithContext>
        /tmp/7bdd55732174400744/vendor/github.com/pulumi/pulumi/sdk/v3/go/pulumi/types.go:495 +0x3fb
 
    error: an unhandled error occurred: program exited with non-zero exit code: 2
how are callers supposed to get the length of DomainValidationOptions? followup would be can pulumi update the referenced example code to include this?