rough-ice-18151
03/10/2025, 8:36 PMApplyT
transform on a string output into an azure-native network.SecurityRuleTypeArrayInput
, but keep on hitting an error:
@ previewing update.....
pulumi:pulumi:Stack byoc-byoc-test-az-2 running error: an unhandled error occurred: go inline source runtime error, an unhandled error occurred: applier's second input parameter must be assignable from interface {}, got string
pulumi:pulumi:Stack byoc-byoc-test-az-2 1 error
Diagnostics:
pulumi:pulumi:Stack (byoc-byoc-test-az-2):
error: an unhandled error occurred: go inline source runtime error, an unhandled error occurred: applier's second input parameter must be assignable from interface {}, got string
applier defined at /home/steven/go/pkg/mod/github.com/pulumi/pulumi/sdk/v3@v3.143.0/go/pulumi/types_builtins.go:4977
My applier looks like this:
ingressRules := sgArgs.BastionSubnetCidr.ToStringPtrOutput().ApplyT(func(bastionCidr *string) ([]network.SecurityRuleTypeArgs, error) {
qdbRules, err := sgArgs.Ingress.AzureNsgRules()
if err != nil {
return nil, err
}
if bastionCidr != nil {
qdbRules = append(qdbRules, network.SecurityRuleTypeArgs{
Access: pulumi.String(network.SecurityRuleAccessAllow),
DestinationAddressPrefix: pulumi.String("*"),
DestinationPortRange: pulumi.String("22"),
Direction: pulumi.String(network.SecurityRuleDirectionInbound),
Name: pulumi.String("bastion ssh"),
Priority: <http://pulumi.Int|pulumi.Int>(105),
Protocol: pulumi.String(network.SecurityConfigurationRuleProtocolTcp),
SourceAddressPrefix: pulumi.String(*bastionCidr),
SourcePortRange: pulumi.String("*"),
})
}
return qdbRules, nil
}).(network.SecurityRuleTypeArrayInput)
where sgArgs.Ingress.AzureNsgRules()
returns a []network.SecurityRuleTypeArgs
.
I'm stumped because I'm not sure where the "applier's second input parameter" is. And why it's a string
...rough-ice-18151
03/11/2025, 12:17 AMrough-ice-18151
03/11/2025, 12:56 AM[]network.SecurityRuleTypeArgs
from ApplyT
? So I can build an array conditionally based on the results of other outputs?echoing-dinner-19531
03/11/2025, 8:46 AMrough-ice-18151
03/11/2025, 3:34 PMNo 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