late-chef-72896
09/02/2024, 11:45 AMArn
in an Array. That array will then later be used in an IAM policy (all the bucket arns will be used in the Policy source
)
The issue I now have is that I initialize an empty Array that I can fill up, but there doesn't seem to be a way to make the Policy depending until populating the Array is finished. This results in an empty Array as the Policy creation will not wait...plain-vegetable-53232
09/02/2024, 2:00 PMApply
function will wait for the resource to be created and for its properties to be resolved before getting the desired value of the propertyplain-vegetable-53232
09/02/2024, 2:01 PMlate-chef-72896
09/02/2024, 2:03 PMApply
function. This Array is used as an input in another resource but since there is no dependency, that Array (which is empty by default) get read right away and doesn't wait until the loop (which populates the Array) is finishedlate-chef-72896
09/02/2024, 2:03 PMplain-vegetable-53232
09/02/2024, 2:07 PMplain-vegetable-53232
09/02/2024, 2:07 PMplain-vegetable-53232
09/02/2024, 2:11 PMpulumi.Run (...
{
var bucketArns pulumi.StringArrayOutput
for loop{
bucket, err := new bucket
bucketArns = pulumi.AppendToStringArrayOutput(bucketArns, bucket.Arn)
} // For loop ends
bucketArns.ApplyT(func(arns []string) error {
iam.NewPolicy(ctx, "testpolicy", args{
Policy: pulumi.Sprintf(`"Resource":%v`, arns)
}
})
})
}
plain-vegetable-53232
09/02/2024, 2:11 PMplain-vegetable-53232
09/02/2024, 2:12 PMlate-chef-72896
09/02/2024, 6:22 PMlate-chef-72896
09/03/2024, 3:55 AMpulumi.AppendToStringArrayOutput
doesn't exist though. Regular append
only works on StringArray
type.late-chef-72896
09/03/2024, 3:56 AMplain-vegetable-53232
09/03/2024, 7:09 AMplain-vegetable-53232
09/03/2024, 7:09 AMlate-chef-72896
09/03/2024, 11:49 AM.All
function does workplain-vegetable-53232
09/03/2024, 12:58 PMplain-vegetable-53232
09/03/2024, 12:58 PMplain-vegetable-53232
09/03/2024, 12:59 PMplain-vegetable-53232
09/03/2024, 1:00 PMplain-vegetable-53232
09/03/2024, 1:01 PM