Skip to content

Commit 01a61dc

Browse files
authored
Merge pull request #4 from synapsestudios/required-provider-fix
Change provider block to required provider
2 parents 0eac29e + 973cdca commit 01a61dc

File tree

7 files changed

+75
-44
lines changed

7 files changed

+75
-44
lines changed

.github/workflows/documentation.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Generate terraform docs
2+
on:
3+
workflow_call:
4+
5+
jobs:
6+
docs:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
with:
11+
ref: ${{ github.event.pull_request.head.ref }}
12+
13+
- name: Render terraform docs inside the README.md and push changes back to PR branch
14+
uses: terraform-docs/gh-actions@v1.0.0
15+
with:
16+
working-dir: .
17+
output-file: README.md
18+
output-method: inject
19+
git-push: "true"

.github/workflows/terraform.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: "Terraform Format"
1+
name: "Terraform"
22
on:
3-
push:
4-
branches:
5-
- "*"
6-
- "*/*"
7-
- "**"
83
pull_request:
94
branches:
105
- "*"
116
- "*/*"
127
- "**"
138

149
jobs:
15-
terraform_format_test:
16-
uses: ./.github/workflows/terraformformat.yml
10+
terraform-format-test:
11+
uses: ./.github/workflows/terraform_format.yml
12+
tfsec-pr-commenter:
13+
uses: ./.github/workflows/tfsec_pr_commenter.yml
14+
terraform-docs:
15+
needs: [terraform-format-test, tfsec-pr-commenter]
16+
uses: ./.github/workflows/documentation.yml

.github/workflows/terraformformat.yml renamed to .github/workflows/terraform_format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup Terraform
1818
uses: hashicorp/setup-terraform@v1
1919
with:
20-
terraform_version: 0.12.31
20+
terraform_version: 1.3.7
2121

2222
- name: Terraform Format
2323
id: fmt
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: tfsec-pr-commenter
2+
on:
3+
workflow_call:
4+
jobs:
5+
tfsec:
6+
name: tfsec PR commenter
7+
runs-on: ubuntu-latest
8+
9+
permissions:
10+
contents: read
11+
pull-requests: write
12+
13+
steps:
14+
- name: Clone repo
15+
uses: actions/checkout@master
16+
- name: tfsec
17+
uses: aquasecurity/tfsec-pr-commenter-action@v1.2.0
18+
with:
19+
tfsec_args: --soft-fail
20+
working_directory: "" # Workaround for PR https://github.com/aquasecurity/tfsec-pr-commenter-action/issues/90
21+
github_token: ${{ github.token }}

README.md

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,40 @@ https://docs.aws.amazon.com/AmazonECR/latest/userguide/repository-create.html
66

77
https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/US_SetupSNS.html
88

9+
<!-- BEGIN_TF_DOCS -->
910
## Requirements
1011

11-
No requirements.
12+
| Name | Version |
13+
|------|---------|
14+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0 |
1215

1316
## Providers
1417

15-
The following providers are used by this module:
16-
17-
- <a name="provider_aws"></a> [aws](#provider_aws) (4.26.0)
18+
| Name | Version |
19+
|------|---------|
20+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.26.0 |
1821

1922
## Modules
2023

2124
No modules.
2225

2326
## Resources
2427

25-
The following resources are used by this module:
26-
27-
- [aws_ecr_lifecycle_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_lifecycle_policy) (resource)
28-
- [aws_ecr_repository.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_repository) (resource)
29-
- [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) (data source)
30-
31-
## Required Inputs
32-
33-
The following input variables are required:
34-
35-
### <a name="input_allowed_arns"></a> [allowed_arns](#input_allowed_arns)
36-
37-
Description: The list of IAM user arns that are allowed to push and pull to and from the repository
38-
39-
Type: `list(string)`
40-
41-
### <a name="input_name"></a> [name](#input_name)
42-
43-
Description: The name of the image repository that we are going to create
44-
45-
Type: `string`
28+
| Name | Type |
29+
|------|------|
30+
| [aws_ecr_lifecycle_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_lifecycle_policy) | resource |
31+
| [aws_ecr_repository.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_repository) | resource |
32+
| [aws_ecr_repository_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_repository_policy) | resource |
33+
| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
4634

47-
## Optional Inputs
35+
## Inputs
4836

49-
No optional inputs.
37+
| Name | Description | Type | Default | Required |
38+
|------|-------------|------|---------|:--------:|
39+
| <a name="input_allowed_arns"></a> [allowed\_arns](#input\_allowed\_arns) | The list of IAM user arns that are allowed to push and pull to and from the repository | `list(string)` | n/a | yes |
40+
| <a name="input_name"></a> [name](#input\_name) | The name of the image repository that we are going to create | `string` | n/a | yes |
5041

5142
## Outputs
5243

5344
No outputs.
45+
<!-- END_TF_DOCS -->

main.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
provider "aws" {
2-
region = var.region
1+
terraform {
2+
required_providers {
3+
aws = {
4+
source = "hashicorp/aws"
5+
version = ">= 4.0"
6+
}
7+
}
38
}
49

510
resource "aws_ecr_repository" "this" {

variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,3 @@ variable "allowed_arns" {
88
description = "The list of IAM user arns that are allowed to push and pull to and from the repository"
99
}
1010

11-
variable "region" {
12-
type = string
13-
default = "us-west-2"
14-
description = "Define the region you'd wish the cloudtrail resources to be created in, example: us-west-2"
15-
}
16-

0 commit comments

Comments
 (0)