Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow cloudfront invalidations #71

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,16 @@ Default password: techtospeech.com
Change these on first log in or specify your own in module instantiation.

You will find WP2Static with S3 Add-on installed. Go to the WP2Static Menu->Addons, and click the 'Disabled' button to
Enable the Add-on.

The configuration of the plugin has been set up such that no additional configuration is required unless you wish to
change any options.
Enable the Add-on. Enable enabling, click the Configure icon on this page. In the S3 table, change "Object ACL" from
"public-read" to "private". In the CloudFront table, copy the region from the S3 table and enter your CloudFront
Distribution ID. You can find the ID in the AWS console. Then click "Save S3 Options". See
[this GitHub issue](https://github.com/TechToSpeech/terraform-aws-serverless-static-wordpress/issues/15) to automate
these changes.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This includes and expands on #69


Finally, you'll need to configure permalinks to a format that is supported on static sites. Go to Settings -> Permalinks
in the sidebar. By default, `plain` is likely selected. You need to change this to any other format for static
publishing to work. Click "Save Changes" to confirm the change. You can confirm you have selected a valid choice by
viewing WP2Static Menu -> Diagnostics.

You may now edit Wordpress as you would normally, customize your site as you like, and when ready proceed to the 'Run'
section of the WP2Static plugin, and click the 'Generate Static Site' button. This will take some minutes depending on
Expand Down
6 changes: 6 additions & 0 deletions ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ data "aws_iam_policy_document" "wordpress_bucket_access" {
effect = "Allow"
resources = ["arn:aws:route53:::hostedzone/${var.hosted_zone_id}"]
}

statement {
actions = ["cloudfront:CreateInvalidation"]
effect = "Allow"
resources = [module.cloudfront.wordpress_cloudfront_distribution_arn]
}
}

resource "aws_iam_policy" "wordpress_bucket_access" {
Expand Down
5 changes: 5 additions & 0 deletions modules/cloudfront/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ output "wordpress_bucket_arn" {
value = aws_s3_bucket.wordpress_bucket.arn
}


output "wordpress_cloudfront_distribution_arn" {
value = aws_cloudfront_distribution.wordpress_distribution.arn
}

output "wordpress_cloudfront_distribution_domain_name" {
value = aws_cloudfront_distribution.wordpress_distribution.domain_name
}
Expand Down