pulumi/tests/testdata/codegen/aws-s3-logging-pp/go/aws-s3-logging.go

30 lines
668 B
Go

package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
logs, err := s3.NewBucket(ctx, "logs", nil)
if err != nil {
return err
}
bucket, err := s3.NewBucket(ctx, "bucket", &s3.BucketArgs{
Loggings: s3.BucketLoggingArray{
&s3.BucketLoggingArgs{
TargetBucket: logs.Bucket,
},
},
})
if err != nil {
return err
}
ctx.Export("targetBucket", bucket.Loggings.ApplyT(func(loggings []s3.BucketLogging) (*string, error) {
return &loggings[0].TargetBucket, nil
}).(pulumi.StringPtrOutput))
return nil
})
}