2024-03-25 15:34:54 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using Pulumi;
|
|
|
|
using Aws = Pulumi.Aws;
|
|
|
|
|
|
|
|
return await Deployment.RunAsync(() =>
|
|
|
|
{
|
|
|
|
var myBucket = new Aws.S3.Bucket("myBucket", new()
|
|
|
|
{
|
|
|
|
Website = new Aws.S3.Inputs.BucketWebsiteArgs
|
|
|
|
{
|
|
|
|
IndexDocument = "index.html",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
var ownershipControls = new Aws.S3.BucketOwnershipControls("ownershipControls", new()
|
|
|
|
{
|
|
|
|
Bucket = myBucket.Id,
|
|
|
|
Rule = new Aws.S3.Inputs.BucketOwnershipControlsRuleArgs
|
|
|
|
{
|
|
|
|
ObjectOwnership = "ObjectWriter",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
var publicAccessBlock = new Aws.S3.BucketPublicAccessBlock("publicAccessBlock", new()
|
|
|
|
{
|
|
|
|
Bucket = myBucket.Id,
|
|
|
|
BlockPublicAcls = false,
|
|
|
|
});
|
|
|
|
|
|
|
|
var indexHtml = new Aws.S3.BucketObject("index.html", new()
|
|
|
|
{
|
|
|
|
Bucket = myBucket.Id,
|
|
|
|
Source = new FileAsset("./index.html"),
|
|
|
|
ContentType = "text/html",
|
|
|
|
Acl = "public-read",
|
|
|
|
}, new CustomResourceOptions
|
|
|
|
{
|
|
|
|
DependsOn =
|
|
|
|
{
|
2024-04-09 21:11:25 +00:00
|
|
|
publicAccessBlock,
|
|
|
|
ownershipControls,
|
2024-03-25 15:34:54 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
return new Dictionary<string, object?>
|
|
|
|
{
|
|
|
|
["bucketName"] = myBucket.Id,
|
|
|
|
["bucketEndpoint"] = myBucket.WebsiteEndpoint.Apply(websiteEndpoint => $"http://{websiteEndpoint}"),
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|