sparse-intern-71089
10/31/2023, 6:43 PMancient-policeman-24615
11/02/2023, 12:47 AMerr
is non-nil, then you are already using ApplyT
correctly:
policyDocument := saml.Arn.ApplyT(yourFunction)
If you want to handle the error and keep going, you will need to do so inside the `ApplyT`:
policyDocument := saml.Arn.ApplyT(func(arn string) (*iam.GetPolicyDocumentResult, error) {
doc, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
Statements: []iam.GetPolicyDocumentStatement{
{
Principals: []iam.GetPolicyDocumentStatementPrincipal{
{
Type: "Federated",
Identifiers: []string{arn},
},
},
},
},
if err != nil {
return defaultDocument(arn)
}
return doc
})
})
The first option is more common in Pulumi programs, but both are available.No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.
Powered by