Skip to content

Commit 2f5f693

Browse files
actions-userLinter Bot
authored andcommitted
Apply automatic changes
1 parent 5e34af3 commit 2f5f693

File tree

6 files changed

+35
-14
lines changed

6 files changed

+35
-14
lines changed

README.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,28 @@ in your module definition.
210210
Gentle reminder that no backup options are currently bundled with this module - the most effective means would be to
211211
generate and retain a backup from within Wordpress for maximum flexibility. We recommend the UpdraftPlus plugin.
212212

213+
## Permanent Redirects
214+
215+
Basic url path based permanent redirects are supported via the CloudFront function. The variable `cloudfront_function_301_redirects` can be set with a custom map of match to destination mappings.
216+
217+
Some aspects that need to be taken into consideration for the match:
218+
219+
* It's a regular expression
220+
* Group replacements are supported
221+
* Runs in a Javascript function, escaping needs to be taken into consideration
222+
* Passed through a TF var, so escaping that needs to be taking into account as well
223+
224+
An example to match a path like `/category-name`, a suitable match would be `"^\\/(category-name)$"`. Breaking down the `\\/` part, the first `\` tells TF to escape the second `\`, which is the Regex escape for the `/` character.
225+
226+
An example:
227+
228+
```
229+
cloudfront_function_301_redirects = {
230+
# Redirects /travel to /category/travel/
231+
"^\\/(travel)$": "/category/$1/",
232+
}
233+
```
234+
213235
## Troubleshooting
214236

215237
If you experience issues with the publish element of WP2Static, you can retry. It can be more reliable to proceed to
@@ -223,13 +245,6 @@ that generates this file and the crawl job can fail fast if it cannot locate it.
223245
relating to WP2Static, [raise an issue on their repo](https://github.com/leonstafford/wp2static/issues).
224246
For any issues relating to this module, [raise an issue against this repo.](https://github.com/TechToSpeech/terraform-aws-serverless-static-wordpress/issues)
225247

226-
227-
### Connecting to container with ECS Exec
228-
229-
ECS Exec is supported to help troubleshooting container issues. Read to [AWS Docs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs-exec.html) for usage instructions.
230-
231-
It's recommended that the `ecs_healthcheck_enabled` variable is set to `false` to prevent the container from being terminated and replaced while troubleshooting.
232-
233248
## Inputs
234249

235250
| Name | Description | Type | Default | Required |
@@ -239,6 +254,7 @@ It's recommended that the `ecs_healthcheck_enabled` variable is set to `false` t
239254
| <a name="input_cloudfront_class"></a> [cloudfront\_class](#input\_cloudfront\_class) | The [price class](https://aws.amazon.com/cloudfront/pricing/) for the distribution. One of: PriceClass\_All, PriceClass\_200, PriceClass\_100 | `string` | `"PriceClass_All"` | no |
240255
| <a name="input_cloudfront_function_301_redirects"></a> [cloudfront\_function\_301\_redirects](#input\_cloudfront\_function\_301\_redirects) | A list of key value pairs of Regex match and destination for 301 redirects at CloudFront. | `map(any)` | <pre>{<br> "^(.*)index\\.php$": "$1"<br>}</pre> | no |
241256
| <a name="input_ecs_cpu"></a> [ecs\_cpu](#input\_ecs\_cpu) | The CPU limit password to the Wordpress container definition. | `number` | `256` | no |
257+
| <a name="input_ecs_healthcheck_enabled"></a> [ecs\_healthcheck\_enabled](#input\_ecs\_healthcheck\_enabled) | Runs an healtchcheck against the container. | `bool` | `true` | no |
242258
| <a name="input_ecs_memory"></a> [ecs\_memory](#input\_ecs\_memory) | The memory limit password to the Wordpress container definition. | `number` | `512` | no |
243259
| <a name="input_graviton_codebuild_enabled"></a> [graviton\_codebuild\_enabled](#input\_graviton\_codebuild\_enabled) | Flag that controls whether CodeBuild should use Graviton-based build agents in [supported regions](https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-compute-types.html). | `bool` | `false` | no |
244260
| <a name="input_graviton_fargate_enabled"></a> [graviton\_fargate\_enabled](#input\_graviton\_fargate\_enabled) | Flag that controls whether ECS Fargate should use Graviton-based containers in [supported regions]https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate-Regions.html). | `bool` | `false` | no |
@@ -259,6 +275,8 @@ It's recommended that the `ecs_healthcheck_enabled` variable is set to `false` t
259275
| <a name="input_wordpress_admin_user"></a> [wordpress\_admin\_user](#input\_wordpress\_admin\_user) | The username of the default wordpress admin user. | `string` | `"supervisor"` | no |
260276
| <a name="input_wordpress_memory_limit"></a> [wordpress\_memory\_limit](#input\_wordpress\_memory\_limit) | The memory to allow the Wordpress process to use (in M) | `string` | `"256M"` | no |
261277
| <a name="input_wordpress_subdomain"></a> [wordpress\_subdomain](#input\_wordpress\_subdomain) | The subdomain used for the Wordpress container. | `string` | `"wordpress"` | no |
278+
| <a name="input_wp2static_s3_addon_version"></a> [wp2static\_s3\_addon\_version](#input\_wp2static\_s3\_addon\_version) | Version of the WP2Static S3 Add-on to use from https://github.com/leonstafford/wp2static-addon-s3/releases/ | `string` | `"1.0"` | no |
279+
| <a name="input_wp2static_version"></a> [wp2static\_version](#input\_wp2static\_version) | Version of WP2Static to use from https://github.com/WP2Static/wp2static/releases | `string` | `"7.1.7"` | no |
262280
## Modules
263281

264282
| Name | Source | Version |
@@ -300,8 +318,10 @@ It's recommended that the `ecs_healthcheck_enabled` variable is set to `false` t
300318
| [aws_efs_file_system.wordpress_persistent](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/efs_file_system) | resource |
301319
| [aws_efs_mount_target.wordpress_efs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/efs_mount_target) | resource |
302320
| [aws_iam_policy.wordpress_bucket_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
321+
| [aws_iam_policy.wordpress_ecs_exec](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy) | resource |
303322
| [aws_iam_role.wordpress_task](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
304323
| [aws_iam_role_policy_attachment.wordpress_bucket_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
324+
| [aws_iam_role_policy_attachment.wordpress_ecs_exec](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
305325
| [aws_iam_role_policy_attachment.wordpress_role_attachment_cloudwatch](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
306326
| [aws_iam_role_policy_attachment.wordpress_role_attachment_ecs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy_attachment) | resource |
307327
| [aws_rds_cluster.serverless_wordpress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster) | resource |
@@ -322,5 +342,6 @@ It's recommended that the `ecs_healthcheck_enabled` variable is set to `false` t
322342
| [random_password.serverless_wordpress_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
323343
| [aws_iam_policy_document.ecs_assume_role_policy](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
324344
| [aws_iam_policy_document.wordpress_bucket_access](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
345+
| [aws_iam_policy_document.wordpress_ecs_exec](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
325346
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
326347
<!-- END_TF_DOCS -->

ecs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ data "aws_iam_policy_document" "wordpress_bucket_access" {
4646

4747
data "aws_iam_policy_document" "wordpress_ecs_exec" {
4848
statement {
49-
actions = [
49+
actions = [
5050
"ssmmessages:CreateControlChannel",
5151
"ssmmessages:CreateDataChannel",
5252
"ssmmessages:OpenControlChannel",
@@ -260,7 +260,7 @@ resource "aws_ecs_service" "wordpress_service" {
260260
propagate_tags = "SERVICE"
261261
# Explicitly setting version here: https://stackoverflow.com/questions/62552562/one-or-more-of-the-requested-capabilities-are-not-supported-aws-fargate
262262
platform_version = "1.4.0"
263-
263+
264264
network_configuration {
265265
subnets = var.subnet_ids
266266
security_groups = [aws_security_group.wordpress_security_group.id]

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module "cloudfront" {
3131
}
3232
depends_on = [aws_acm_certificate_validation.wordpress_site,
3333
module.waf]
34-
34+
3535
cloudfront_class = var.cloudfront_class
3636
waf_acl_arn = var.waf_enabled ? module.waf[0].waf_acl_arn : null
3737
cloudfront_function_301_redirects = var.cloudfront_function_301_redirects

modules/codebuild/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This module sets up the build to take a vanilla Wordpress image and bake customi
1616
| <a name="input_site_name"></a> [site\_name](#input\_site\_name) | The unique name for this instance of the module. Required to deploy multiple wordpress instances to the same AWS account (if desired). | `string` | n/a | yes |
1717
| <a name="input_wordpress_ecr_repository"></a> [wordpress\_ecr\_repository](#input\_wordpress\_ecr\_repository) | The ECR repository where the Wordpress image is stored. | `string` | n/a | yes |
1818
| <a name="input_wp2static_s3_addon_version"></a> [wp2static\_s3\_addon\_version](#input\_wp2static\_s3\_addon\_version) | Version of the WP2Static S3 Add-on to use from https://github.com/leonstafford/wp2static-addon-s3/releases/ | `string` | `"1.0"` | no |
19-
| <a name="input_wp2static_version"></a> [wp2static\_version](#input\_wp2static\_version) | Version of WP2Static to use from https://github.com/leonstafford/wp2static/releases | `string` | `"7.1.7"` | no |
19+
| <a name="input_wp2static_version"></a> [wp2static\_version](#input\_wp2static\_version) | Version of WP2Static to use from https://github.com/WP2Static/wp2static/releases | `string` | `"7.1.7"` | no |
2020
## Modules
2121

2222
No modules.

task-definitions/wordpress.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[
2-
{
2+
{
33
"cpu": ${tonumber(container_cpu)},
44
"environment": [
55
{"name": "ECS_ENABLE_CONTAINER_METADATA", "value": "true"},
@@ -42,7 +42,7 @@
4242
"timeout": 5,
4343
"interval": 10,
4444
"startPeriod": 60
45-
},
45+
},
4646
%{ endif }
4747
"volumesFrom" : [],
4848
"logConfiguration": {

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ variable "ecs_memory" {
8282
variable "ecs_healthcheck_enabled" {
8383
default = true
8484
description = "Runs an healtchcheck against the container."
85-
type = bool
85+
type = bool
8686
}
8787

8888
variable "snapshot_identifier" {

0 commit comments

Comments
 (0)