0.7.2 • Published 2 months ago

@wanews/pulumi-static-site v0.7.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

pulumi-static-site

Provides an S3 bucket behind a CloudFront distribution for use as a static site.

Implements the Using a website endpoint as the origin, with access restricted by a Referer header behaviour as described by https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-serve-static-website/

Usage

import { StaticSite } from '@wanews/pulumi-static-site'

new StaticSite('example.com', {
  primaryDomain: 'example.com',
  getTags: (name) => ({ name }),
})

Running unit tests

Run nx test pulumi-static-site to execute the unit tests via Jest.

Importing existing resources

This module allows existing buckets and distributions to be imported instead of creating new ones.

S3 Bucket

To import an existing bucket, use importPrimaryBucket. However, pulumi refuses to import a resources unless its args match those of the resource to be imported, so the bucket args will typically need to be overridden too.

import { StaticSite } from '@wanews/pulumi-static-site'

new StaticSite('example.com', {
  primaryDomain: 'example.com',
  getTags: (name) => ({ name }),
  importPrimaryBucket: {
    bucketId: 'my-bucket',
    overrideBucketArgs: {
      bucket: 'my-bucket',
      tags: { /* my-tags */ },
      // etc
    }
  },
})

Once the resource has been imported, remove the importPrimaryBucket to apply the new settings. If you still need to override any bucket args, use bucketOptions.

import { StaticSite } from '@wanews/pulumi-static-site'

new StaticSite('example.com', {
  primaryDomain: 'example.com',
  getTags: (name) => ({ name }),
  bucketOptions: {
    bucket: 'my-bucket',
  },
})
0.7.2

2 months ago

0.5.4

2 years ago

0.7.1

2 years ago

0.6.2

2 years ago

0.5.3

2 years ago

0.5.0

2 years ago

0.7.0

2 years ago

0.6.1

2 years ago

0.5.2

2 years ago

0.6.0

2 years ago

0.5.1

2 years ago

0.4.2

2 years ago

0.3.0

2 years ago

0.4.0

2 years ago

0.1.0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago