Created
December 8, 2022 10:39
-
-
Save shar1z/5b906bb009715c3d6a6d3ba10e356b08 to your computer and use it in GitHub Desktop.
Pulumi GIST
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/s3" | |
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/sns" | |
"github.com/pulumi/pulumi/sdk/v2/go/pulumi" | |
) | |
func main() { | |
pulumi.Run(func(ctx *pulumi.Context) error { | |
// Create an S3 bucket. | |
bucket, err := s3.NewBucket(ctx, "my-bucket", &s3.BucketArgs{ | |
// Add other bucket configuration options here. | |
}) | |
if err != nil { | |
return err | |
} | |
// Create an SNS topic for notifications. | |
topic, err := sns.NewTopic(ctx, "my-topic", &sns.TopicArgs{ | |
// Add other topic configuration options here. | |
}) | |
if err != nil { | |
return err | |
} | |
// Add an SNS topic subscription for the bucket. | |
_, err = s3.NewBucketNotification(ctx, "bucket-notification", &s3.BucketNotificationArgs{ | |
Bucket: bucket.ID(), | |
TopicConfigurations: s3.BucketNotificationTopicConfigurationArray{ | |
s3.BucketNotificationTopicConfigurationArgs{ | |
TopicArn: topic.Arn, | |
// Add other topic configuration options here. | |
}, | |
}, | |
}) | |
if err != nil { | |
return err | |
} | |
return nil | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment