Skip to content

Commit 859ace4

Browse files
authored
Fix issue #29 (#30)
* Fix issue #29 * Fix infracost pipeline
1 parent 013ad11 commit 859ace4

File tree

15 files changed

+299
-14
lines changed

15 files changed

+299
-14
lines changed

.github/workflows/pipeline.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,32 +17,44 @@ jobs:
1717
validate:
1818
runs-on: ubuntu-latest
1919
container: hashicorp/terraform
20+
strategy:
21+
matrix: {
22+
dir: ['examples/complete', 'examples/no-cert', 'examples/no-cert-no-hosted-zone', 'examples/no-hosted-zone']
23+
}
2024
steps:
2125
- name: Checkout repository
2226
uses: actions/checkout@v3
2327
- name: Terraform Init
2428
run: terraform init -upgrade
25-
working-directory: examples/test
29+
working-directory: ${{ matrix.dir }}
2630
- name: Terraform Validate
2731
run: terraform validate
28-
working-directory: examples/test
32+
working-directory: ${{ matrix.dir }}
2933

3034
mock-plan:
3135
runs-on: ubuntu-latest
3236
container: hashicorp/terraform
37+
strategy:
38+
matrix: {
39+
dir: ['examples/complete', 'examples/no-cert', 'examples/no-cert-no-hosted-zone', 'examples/no-hosted-zone']
40+
}
3341
steps:
3442
- name: Checkout repository
3543
uses: actions/checkout@v3
3644
- name: Terraform Init
3745
run: terraform init -upgrade
38-
working-directory: examples/test
46+
working-directory: ${{ matrix.dir }}
3947
- name: Terraform Plan (Mock)
4048
run: terraform plan
41-
working-directory: examples/test
49+
working-directory: ${{ matrix.dir }}
4250

4351
infracost:
4452
runs-on: ubuntu-latest
4553
name: Show infracost diff
54+
strategy:
55+
matrix: {
56+
dir: ['examples/complete', 'examples/no-cert', 'examples/no-cert-no-hosted-zone', 'examples/no-hosted-zone']
57+
}
4658
steps:
4759
- name: Check out repository
4860
uses: actions/checkout@v2
@@ -52,4 +64,4 @@ jobs:
5264
INFRACOST_API_KEY: ${{ secrets.INFRACOST_API_KEY }}
5365
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5466
with:
55-
path: examples/test
67+
path: ${{ matrix.dir }}

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,17 @@ In order to run all checks at any point run the following command:
7676
| Name | Description | Type | Default | Required |
7777
|------|-------------|------|---------|:--------:|
7878
| <a name="input_acm_certificate_arn_to_use"></a> [acm\_certificate\_arn\_to\_use](#input\_acm\_certificate\_arn\_to\_use) | ACM Certificate ARN to use in case you disable automatic certificate creation. Certificate must be in us-east-1 region. | `string` | `""` | no |
79-
| <a name="input_cloudfront_web_acl_id"></a> [cloudfront\_web\_acl\_id](#input\_cloudfront\_web\_acl\_id) | (Optional) - A unique identifier that specifies the AWS WAF web ACL, if any, to associate with this distribution.
80-
To specify a web ACL created using the latest version of AWS WAF (WAFv2), use the ACL ARN, for example aws_wafv2_web_acl.example.arn. To specify a web ACL created using AWS WAF Classic, use the ACL ID, for example aws_waf_web_acl.example.id. The WAF Web ACL must exist in the WAF Global (CloudFront) region and the credentials configuring this argument must have waf:GetWebACL permissions assigned. | `string` | `null` | no |
8179
| <a name="input_aws_accounts_with_read_view_log_bucket"></a> [aws\_accounts\_with\_read\_view\_log\_bucket](#input\_aws\_accounts\_with\_read\_view\_log\_bucket) | List of AWS accounts with read permissions to log bucket | `list(string)` | `[]` | no |
8280
| <a name="input_cloudfront_allowed_cached_methods"></a> [cloudfront\_allowed\_cached\_methods](#input\_cloudfront\_allowed\_cached\_methods) | (Optional) Specifies which methods are allowed and cached by CloudFront. Can be GET, PUT, POST, DELETE or HEAD. Defaults to GET and HEAD | `list(string)` | <pre>[<br> "GET",<br> "HEAD"<br>]</pre> | no |
81+
| <a name="input_cloudfront_custom_error_responses"></a> [cloudfront\_custom\_error\_responses](#input\_cloudfront\_custom\_error\_responses) | A list of custom error responses | <pre>list(object({<br> error_caching_min_ttl = number<br> error_code = number<br> response_code = number<br> response_page_path = string<br> }))</pre> | `[]` | no |
8382
| <a name="input_cloudfront_default_root_object"></a> [cloudfront\_default\_root\_object](#input\_cloudfront\_default\_root\_object) | (Optional) - The object that you want CloudFront to return (for example, index.html) when an end user requests the root URL. Defaults to index.html | `string` | `"index.html"` | no |
84-
| <a name="input_cloudfront_function_association"></a> [cloudfront\_function\_association](#input\_cloudfront\_function\_association) | (Optional) Map containing information to associate a function to cloudfront. The first field is `event_type` of the function associated with default cache behavior, it can be viewer-request, viewer-response, origin-request, origin-response. The second field is `function_arn`, the ARN of the function associated with default cache behavior | <pre>list(<br>object({<br> event_type = string<br> function_arn = string<br> }))</pre> | `null` | no |
85-
| <a name="input_cloudfront_custom_error_responses"></a> [cloudfront\_custom\_error\_responses](#input\_cloudfront\_custom\_erro\r_responses) | (Optional) A list of Cloudfront custom error messages objects | <pre>list(<br> object({ <br>error_caching_min_ttl = number<br>error_code = number <br>response_code = number<br>response_page_path = string <br>}))</pre> | `[]` | no |
83+
| <a name="input_cloudfront_function_association"></a> [cloudfront\_function\_association](#input\_cloudfront\_function\_association) | (Optional - up to 2 per distribution) List containing information to associate a CF function to cloudfront. The first field is `event_type` of the CF function associated with default cache behavior, it can be viewer-request or viewer-response | <pre>list(object({<br> event_type = string<br> function_arn = string<br> }))</pre> | `[]` | no |
8684
| <a name="input_cloudfront_geo_restriction_locations"></a> [cloudfront\_geo\_restriction\_locations](#input\_cloudfront\_geo\_restriction\_locations) | (Optional) - The ISO 3166-1-alpha-2 codes for which you want CloudFront either to distribute your content (whitelist) or not distribute your content (blacklist). Defaults to [] | `list(string)` | `[]` | no |
8785
| <a name="input_cloudfront_geo_restriction_type"></a> [cloudfront\_geo\_restriction\_type](#input\_cloudfront\_geo\_restriction\_type) | The method that you want to use to restrict distribution of your content by country: none, whitelist, or blacklist. Defaults to none | `string` | `"none"` | no |
8886
| <a name="input_cloudfront_http_version"></a> [cloudfront\_http\_version](#input\_cloudfront\_http\_version) | (Optional) - The maximum HTTP version to support on the distribution. Allowed values are http1.1 and http2. The default is http2. | `string` | `"http2"` | no |
8987
| <a name="input_cloudfront_price_class"></a> [cloudfront\_price\_class](#input\_cloudfront\_price\_class) | (Optional) - The price class for this distribution. One of PriceClass\_All, PriceClass\_200, PriceClass\_100. Defaults to PriceClass\_100 | `string` | `"PriceClass_100"` | no |
9088
| <a name="input_cloudfront_viewer_protocol_policy"></a> [cloudfront\_viewer\_protocol\_policy](#input\_cloudfront\_viewer\_protocol\_policy) | Use this element to specify the protocol that users can use to access the files in the origin specified by TargetOriginId when a request matches the path pattern in PathPattern. One of allow-all, https-only, or redirect-to-https. Defautls to redirect-to-https | `string` | `"redirect-to-https"` | no |
89+
| <a name="input_cloudfront_web_acl_id"></a> [cloudfront\_web\_acl\_id](#input\_cloudfront\_web\_acl\_id) | (Optional) A unique identifier that specifies the AWS WAF web ACL, if any, to associate with this distribution. | `string` | `null` | no |
9190
| <a name="input_cloudfront_website_retain_on_delete"></a> [cloudfront\_website\_retain\_on\_delete](#input\_cloudfront\_website\_retain\_on\_delete) | (Optional) - Disables the distribution instead of deleting it when destroying the resource through Terraform. If this is set, the distribution needs to be deleted manually afterwards. Defaults to false. | `bool` | `false` | no |
9291
| <a name="input_cloudfront_website_wait_for_deployment"></a> [cloudfront\_website\_wait\_for\_deployment](#input\_cloudfront\_website\_wait\_for\_deployment) | (Optional) - If enabled, the resource will wait for the distribution status to change from InProgress to Deployed. Setting this tofalse will skip the process. Defaults to true. | `bool` | `true` | no |
9392
| <a name="input_comment_for_cloudfront_website"></a> [comment\_for\_cloudfront\_website](#input\_comment\_for\_cloudfront\_website) | Comment for the Website CloudFront Distribution | `string` | `""` | no |

examples/test/main.tf renamed to examples/complete/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ module "test_website" {
77
aws.acm_provider = aws.acm_provider
88
}
99

10-
website_domain_name = "test.com"
11-
create_acm_certificate = true
10+
website_domain_name = "test.com"
11+
12+
create_acm_certificate = true
13+
1214
create_route53_hosted_zone = true
1315

1416
aws_accounts_with_read_view_log_bucket = ["mock_account"]
File renamed without changes.

examples/no-cert-no-hosted-zone/.terraform.lock.hcl

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module "test_website" {
2+
source = "../../"
3+
name_prefix = "test-website"
4+
5+
providers = {
6+
aws.main = aws.main
7+
aws.acm_provider = aws.acm_provider
8+
}
9+
10+
website_domain_name = "test.com"
11+
12+
create_acm_certificate = false
13+
acm_certificate_arn_to_use = "arn:aws:acm:us-east-1:123456789000:certificate/01234567-89a-bcde-f012-3456789abcde"
14+
15+
create_route53_hosted_zone = false
16+
route53_hosted_zone_id = "0123456789ABCDEFGHIJK"
17+
18+
aws_accounts_with_read_view_log_bucket = ["mock_account"]
19+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
terraform {
2+
required_version = ">= 0.13"
3+
required_providers {
4+
aws = {
5+
source = "hashicorp/aws"
6+
version = ">= 4.0"
7+
}
8+
}
9+
}
10+
11+
provider "aws" {
12+
region = "us-east-1"
13+
skip_credentials_validation = true
14+
skip_requesting_account_id = true
15+
skip_metadata_api_check = true
16+
s3_use_path_style = true
17+
access_key = "mock_access_key" # tfsec:ignore:general-secrets-no-plaintext-exposure
18+
secret_key = "mock_secret_key" # tfsec:ignore:general-secrets-no-plaintext-exposure
19+
alias = "main"
20+
}
21+
22+
provider "aws" {
23+
region = "us-east-1"
24+
skip_credentials_validation = true
25+
skip_requesting_account_id = true
26+
skip_metadata_api_check = true
27+
s3_use_path_style = true
28+
access_key = "mock_access_key" # tfsec:ignore:general-secrets-no-plaintext-exposure
29+
secret_key = "mock_secret_key" # tfsec:ignore:general-secrets-no-plaintext-exposure
30+
alias = "acm_provider"
31+
}

examples/no-cert/.terraform.lock.hcl

Lines changed: 41 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/no-cert/main.tf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module "test_website" {
2+
source = "../../"
3+
name_prefix = "test-website"
4+
5+
providers = {
6+
aws.main = aws.main
7+
aws.acm_provider = aws.acm_provider
8+
}
9+
10+
website_domain_name = "test.com"
11+
12+
create_acm_certificate = false
13+
acm_certificate_arn_to_use = "arn:aws:acm:us-east-1:123456789000:certificate/01234567-89a-bcde-f012-3456789abcde"
14+
15+
create_route53_hosted_zone = true
16+
17+
aws_accounts_with_read_view_log_bucket = ["mock_account"]
18+
}

0 commit comments

Comments
 (0)