pulumi/pkg/codegen/internal/test/testdata/aws-s3-folder.pp
Pat Gavlin 2f22c1c59c
HCL2 updates (#4309)
Pulumi HCL2 IR:
- Add support for invokes
- Add support for resource options, incl. ranged resources
- Allow the apply rewriter to ignore promise-typed values
- Add tests for the binder
- Add support functions for TF: entries and range

NodeJS codegen:
- Simplify for expression codegen
- Add support for invoke codegen
- Add support for entries and range functions
- Add tests

Python codegen:
- Implement codegen for most expression types
- Add support for invoke codegen
- Add tests
2020-04-06 19:43:16 -07:00

42 lines
1.1 KiB
Puppet

// Create a bucket and expose a website index document
resource siteBucket "aws:s3:Bucket" {
website = {
indexDocument = "index.html"
}
}
siteDir = "www" // directory for content files
// For each file in the directory, create an S3 object stored in `siteBucket`
resource files "aws:s3:BucketObject" {
options {
range = readDir(siteDir)
}
bucket = siteBucket.id // Reference the s3.Bucket object
key = range.value // Set the key appropriately
source = fileAsset("${siteDir}/${range.value}") // use fileAsset to point to a file
contentType = mimeType(range.value) // set the MIME type of the file
}
// Set the access policy for the bucket so all objects are readable
resource bucketPolicy "aws:s3:BucketPolicy" {
bucket = siteBucket.id // refer to the bucket created earlier
// The policy is JSON-encoded.
policy = toJSON({
Version = "2012-10-17"
Statement = [{
Effect = "Allow"
Principal = "*"
Action = [ "s3:GetObject" ]
Resource = [ "arn:aws:s3:::${siteBucket.id}/*" ]
}]
})
}
// Stack outputs
output bucketName { value = siteBucket.bucket }
output websiteUrl { value = siteBucket.websiteEndpoint }