Skip to content

Commit

Permalink
chore: update readme and pre-commit (#138)
Browse files Browse the repository at this point in the history
* style: tfsort on variables

* docs: Updating readme example to include required zone_id input

* chore: remove unused variables

* style: tflint

* docs: update README

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
esacteksab and github-actions[bot] authored Jan 15, 2025
1 parent 1fb638a commit 93de799
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ on:

jobs:
validate-tf:
uses: trussworks/shared-actions/.github/workflows/validate-tf.yml@main
uses: trussworks/shared-actions/.github/workflows/validate-tf.yml@3cab03ab95045711da37ad6d63a93c666fc22398 # v0.0.2
3 changes: 2 additions & 1 deletion .markdownlintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"first-line-h1": false,
"line_length": false,
"no-multiple-blanks": false,
"no-inline-html": false
"no-inline-html": false,
"no-alt-text": false
}
22 changes: 6 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v5.0.0
hooks:
- id: check-json
- id: check-merge-conflict
Expand All @@ -14,27 +14,17 @@ repos:
- id: end-of-file-fixer
- id: mixed-line-ending

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.16
hooks:
- id: mdformat
additional_dependencies:
- mdformat-gfm
- mdformat-toc
# mdformat fights with terraform_docs
exclude: README.m(ark)?d(own)?

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.33.0
rev: v0.43.0
hooks:
- id: markdownlint

- repo: https://github.com/detailyang/pre-commit-shell
rev: 1.0.5
- repo: https://github.com/terraform-docs/terraform-docs
rev: "v0.19.0"
hooks:
- id: shell-lint
- id: terraform-docs-system

- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.77.1
rev: v1.96.3
hooks:
- id: terraform_fmt
31 changes: 31 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
version: ">= 0.19.0, < 1.0.0"

settings:
html: false
anchor: false
escape: false
lockfile: false
hide-empty: true
formatter: "markdown table"

sort:
enabled: true
by: required

sections:
show:
- requirements
- providers
- modules
- data-sources
- resources
- inputs
- outputs

recursive:
enabled: false
include-main: false

output:
file: README.md
mode: inject
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module "acm_cert" {
alb_listener_arn = "arn:aws:elasticloadbalancing:us-west-2:..."
domain_name = "www.example.com"
zone_name = "example.com"
zone_id = "ABCDEFGHIGJLK1234"
}
```

Expand All @@ -33,10 +33,6 @@ module "acm_cert" {
|------|---------|
| aws | >= 3.0 |

## Modules

No modules.

## Resources

| Name | Type |
Expand All @@ -51,18 +47,16 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| alb\_listener\_arn | Associate ACM certificate to an ALB listener. | `string` | `""` | no |
| caa\_records | Add CAA records to route53. | `list(string)` | `[]` | no |
| domain\_name | Domain name to associate with the ACM certificate. | `string` | n/a | yes |
| environment | Environment tag. e.g. prod | `string` | n/a | yes |
| tags | Tags to be attached to the ACM certificate. | `map(string)` | `{}` | no |
| zone\_id | The Route53 zone id for which the certificate should be verified and issued. | `string` | n/a | yes |
| domain_name | Domain name to associate with the ACM certificate. | `string` | n/a | yes |
| zone_id | The Route53 zone id for which the certificate should be verified and issued. | `string` | n/a | yes |
| alb_listener_arn | Associate ACM certificate to an ALB listener. | `string` | `""` | no |
| caa_records | Add CAA records to route53. | `list(string)` | `[]` | no |

## Outputs

| Name | Description |
|------|-------------|
| acm\_arn | The ARN of the validated ACM certificate. |
| acm_arn | The ARN of the validated ACM certificate. |
<!-- END_TF_DOCS -->

## Developer Setup
Expand Down
3 changes: 1 addition & 2 deletions examples/simple/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ module "acm-cert" {
source = "../.."

domain_name = "${var.test_name}.${local.zone_name}"
environment = local.environment
zone_name = local.zone_name
zone_id = "abcd123456"
}
2 changes: 0 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ resource "aws_acm_certificate" "main" {
domain_name = var.domain_name
validation_method = "DNS"

tags = var.tags

lifecycle {
create_before_destroy = true
}
Expand Down
22 changes: 18 additions & 4 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
{
"extends": [
"config:base"
"config:recommended",
"helpers:pinGitHubActionDigests"
],
"labels": [
"dependencies"
],
"packageRules": [
{
"automerge": true,
"description": "Automerge all updates except major versions",
"matchUpdateTypes": [
"patch",
"pin",
"digest",
"minor"
]
},
{
"description": "Tag the waddlers Github Team for major updates",
"matchUpdateTypes": [
Expand All @@ -19,11 +30,14 @@
"automerge": true,
"description": "Group minor and patch updates into a single PR",
"groupName": "dependencies",
"matchManagers": [
"terraform",
"pre-commit",
"github-actions"
],
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest"
"patch"
]
}
],
Expand Down
23 changes: 6 additions & 17 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,18 @@ variable "alb_listener_arn" {
default = ""
}

variable "domain_name" {
type = string
description = "Domain name to associate with the ACM certificate."
variable "caa_records" {
description = "Add CAA records to route53."
type = list(string)
default = []
}

variable "environment" {
variable "domain_name" {
type = string
description = "Environment tag. e.g. prod"
description = "Domain name to associate with the ACM certificate."
}

variable "zone_id" {
type = string
description = "The Route53 zone id for which the certificate should be verified and issued."
}

variable "caa_records" {
description = "Add CAA records to route53."
type = list(string)
default = []
}

variable "tags" {
description = "Tags to be attached to the ACM certificate."
type = map(string)
default = {}
}
5 changes: 4 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ terraform {
required_version = ">= 1.0"

required_providers {
aws = ">= 3.0"
aws = {
source = "hashicorp/aws"
version = ">= 3.0"
}
}
}

0 comments on commit 93de799

Please sign in to comment.