Skip to content

Commit c1737cf

Browse files
authored
Merge pull request #9 from geekcell/missing-tags
fix: add missing tags
2 parents dd64232 + d7d9509 commit c1737cf

13 files changed

+119
-2
lines changed

.github/.templatesyncignore

+4
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@ README.md
22
.github/workflows/*
33
.terraform-docs.yml
44
docs/20-badges.md
5+
docs/assets/logo.svg
56
*.tf
7+
test/*
8+
go.mod
9+
go.sum

.pre-commit-config.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.76.0
3+
rev: v1.80.0
44
hooks:
55
- id: terraform_docs
66
- id: terraform_fmt
77
- id: terraform_validate
8+
args:
9+
- --hook-config=--retry-once-with-cleanup=true
810
exclude: '^[^/]+$'
911
- id: terraform_tflint
1012
exclude: ^examples/
1113

1214
- repo: https://github.com/pre-commit/pre-commit-hooks
13-
rev: v4.3.0
15+
rev: v4.4.0
1416
hooks:
1517
- id: trailing-whitespace
1618
- id: end-of-file-fixer

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ each module for more information. All modules are enabled by default.
4343
| Name | Description | Type | Default | Required |
4444
|------|-------------|------|---------|:--------:|
4545
| <a name="input_enable_cloudwatch_defaults"></a> [enable\_cloudwatch\_defaults](#input\_enable\_cloudwatch\_defaults) | Enable the Cloudwatch submodule. | `bool` | `true` | no |
46+
| <a name="input_enable_iam_access_analyzer"></a> [enable\_iam\_access\_analyzer](#input\_enable\_iam\_access\_analyzer) | Enable the IAM Access Analyzer submodule. | `bool` | `true` | no |
4647
| <a name="input_enable_iam_account_password_policy"></a> [enable\_iam\_account\_password\_policy](#input\_enable\_iam\_account\_password\_policy) | Enable the IAM Account Password Policy submodule. | `bool` | `true` | no |
4748
| <a name="input_enable_s3_defaults"></a> [enable\_s3\_defaults](#input\_enable\_s3\_defaults) | Enable the S3 submodule. | `bool` | `true` | no |
49+
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources. | `map(string)` | `{}` | no |
4850

4951
## Outputs
5052

main.tf

+9
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,18 @@ module "s3" {
1212
module "cloudwatch" {
1313
count = var.enable_cloudwatch_defaults ? 1 : 0
1414
source = "./modules/cloudwatch"
15+
16+
tags = var.tags
1517
}
1618

1719
module "iam_account_password_policy" {
1820
count = var.enable_iam_account_password_policy ? 1 : 0
1921
source = "./modules/iam_password_policy"
2022
}
23+
24+
module "iam_access_analyzer" {
25+
count = var.enable_iam_access_analyzer ? 1 : 0
26+
source = "./modules/iam_access_analyzer"
27+
28+
tags = var.tags
29+
}

modules/cloudwatch/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ terraform import 'aws\_cloudwatch\_log\_group.rds\_log\_group' 'RDSOSMetrics'
1616
| Name | Description | Type | Default | Required |
1717
|------|-------------|------|---------|:--------:|
1818
| <a name="input_cloudwatch_log_group_rdsosmetrics_retention_in_days"></a> [cloudwatch\_log\_group\_rdsosmetrics\_retention\_in\_days](#input\_cloudwatch\_log\_group\_rdsosmetrics\_retention\_in\_days) | The number of days log events are kept in CloudWatch Logs for the default RDSOSMetrics group. | `number` | `365` | no |
19+
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources. | `map(string)` | `{}` | no |
1920

2021
## Outputs
2122

modules/cloudwatch/main.tf

+2
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@
1414
resource "aws_cloudwatch_log_group" "rdsosmetrics" {
1515
name = "RDSOSMetrics"
1616
retention_in_days = var.cloudwatch_log_group_rdsosmetrics_retention_in_days
17+
18+
tags = var.tags
1719
}

modules/cloudwatch/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
variable "tags" {
2+
description = "A map of tags to add to all resources."
3+
type = map(string)
4+
default = {}
5+
}
6+
17
variable "cloudwatch_log_group_rdsosmetrics_retention_in_days" {
28
description = "The number of days log events are kept in CloudWatch Logs for the default RDSOSMetrics group."
39
default = 365
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
content: |-
2+
{{ .Header }}
3+
4+
{{ .Inputs }}
5+
6+
{{ .Outputs }}
7+
8+
{{ .Providers }}
9+
10+
## Resources
11+
{{ range .Module.Resources }}
12+
- {{ .GetMode }}.{{ .Spec }} ({{ .Position.Filename }}#{{ .Position.Line }})
13+
{{- end }}

modules/iam_access_analyzer/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
# Terraform AWS Account Defaults Access Analyzer
3+
4+
Creates an AWS Access Analyzer for the account or organization.
5+
6+
## Inputs
7+
8+
| Name | Description | Type | Default | Required |
9+
|------|-------------|------|---------|:--------:|
10+
| <a name="input_access_analyzer_name"></a> [access\_analyzer\_name](#input\_access\_analyzer\_name) | The name of the analyzer. | `string` | `"account-default"` | no |
11+
| <a name="input_access_analyzer_type"></a> [access\_analyzer\_type](#input\_access\_analyzer\_type) | The type of analyzer, ACCOUNT or ORGANIZATION. | `string` | `"ACCOUNT"` | no |
12+
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources. | `map(string)` | `{}` | no |
13+
14+
## Outputs
15+
16+
No outputs.
17+
18+
## Providers
19+
20+
| Name | Version |
21+
|------|---------|
22+
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.0 |
23+
24+
## Resources
25+
26+
- resource.aws_accessanalyzer_analyzer.main (modules/iam_access_analyzer/main.tf#6)
27+
<!-- END_TF_DOCS -->

modules/iam_access_analyzer/main.tf

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* # Terraform AWS Account Defaults Access Analyzer
3+
*
4+
* Creates an AWS Access Analyzer for the account or organization.
5+
*/
6+
resource "aws_accessanalyzer_analyzer" "main" {
7+
analyzer_name = var.access_analyzer_name
8+
type = var.access_analyzer_type
9+
10+
tags = var.tags
11+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
variable "tags" {
2+
description = "A map of tags to add to all resources."
3+
type = map(string)
4+
default = {}
5+
}
6+
7+
variable "access_analyzer_name" {
8+
description = "The name of the analyzer."
9+
default = "account-default"
10+
type = string
11+
}
12+
13+
variable "access_analyzer_type" {
14+
description = "The type of analyzer, ACCOUNT or ORGANIZATION."
15+
default = "ACCOUNT"
16+
type = string
17+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
terraform {
2+
required_version = ">= 1.3"
3+
4+
required_providers {
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = "~> 4.0"
8+
}
9+
}
10+
}

variables.tf

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
variable "tags" {
2+
description = "A map of tags to add to all resources."
3+
type = map(string)
4+
default = {}
5+
}
6+
17
## S3 PUBLIC ACCESS
28
variable "enable_s3_defaults" {
39
description = "Enable the S3 submodule."
@@ -18,3 +24,10 @@ variable "enable_iam_account_password_policy" {
1824
default = true
1925
type = bool
2026
}
27+
28+
## IAM ACCESS ANALYZER
29+
variable "enable_iam_access_analyzer" {
30+
description = "Enable the IAM Access Analyzer submodule."
31+
default = true
32+
type = bool
33+
}

0 commit comments

Comments
 (0)