Skip to content

Commit

Permalink
Merge pull request #311 from MarcEspiard/expose-bucketName-static-web…
Browse files Browse the repository at this point in the history
…site-abstract
  • Loading branch information
fredericbarthelet authored Mar 3, 2023
2 parents a5da047 + 682681c commit 96c8b37
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/single-page-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,24 @@ resources:

_How it works: the `${construct:landing.cname}` variable will automatically be replaced with a CloudFormation reference to the CloudFront Distribution._

- `assetsBucketName`: the S3 assets bucketname

This can be used to configure a S3 bucket policy for example:

```yaml
constructs:
landing:
type: single-page-app
# ...
resources:
Resources:
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: ${construct:landing.assetsBucketName}
# ...
```

## Configuration reference

### Path
Expand Down
18 changes: 18 additions & 0 deletions docs/static-website.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,24 @@ resources:

_How it works: the `${construct:landing.cname}` variable will automatically be replaced with a CloudFormation reference to the CloudFront Distribution._

- `assetsBucketName`: the S3 assets bucketname

This can be used to configure a S3 bucket policy for example:

```yaml
constructs:
landing:
type: static-website
# ...
resources:
Resources:
BucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: ${construct:landing.assetsBucketName}
# ...
```

## Configuration reference

### Path
Expand Down
1 change: 1 addition & 0 deletions src/constructs/aws/abstracts/StaticWebsiteAbstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export abstract class StaticWebsiteAbstract extends AwsConstruct {
variables(): Record<string, unknown> {
return {
cname: this.distribution.distributionDomainName,
assetsBucketName: this.bucket.bucketName,
};
}

Expand Down

0 comments on commit 96c8b37

Please sign in to comment.