Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: ✏️ Automatic tfdocs and cleaning up #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Generate terraform docs
on:
pull_request:

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}

- name: Render terraform docs inside the README.md
uses: terraform-docs/[email protected]
with:
working-dir: .
git-push: "true"
output-file: README.md
config-file: ".terraform-docs.yml"
29 changes: 29 additions & 0 deletions .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Validate Terraform manifests with tflint

on:
pull_request:

jobs:
tflint:
name: tflint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: 1.3.0

- name: Terraform Init
run: terraform init

- name: Check with tflint
uses: reviewdog/action-tflint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
fail_on_error: "true"
filter_mode: "nofilter"
flags: "--module"
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/terraform-aws-vpc.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 57 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
formatter: markdown

output:
file: README.md
mode: replace
template: |-

# terraform-aws-vpc

Terraform module to provision an [`Amazon Virtual Private Cloud`](https://aws.amazon.com/en/vpc/).

We're using the module [`terraform-aws-modules/vpc/aws`](https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/5.0.0) behind the scenes.

You can find the documentation for the module [`here`](https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/5.0.0)

## Usage

### Basic

```hcl
module "vpc" {
source = "github.com/developertown/terraform-aws-vpc.git?ref=vVERSION"

name = "my-vpc"
cidr = "10.0.0.0/16"

azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"]

enable_nat_gateway = true
enable_vpn_gateway = true

tags = {
Terraform = "true"
Environment = "dev"
}
}
```

sort:
enabled: true
by: required

settings:
anchor: true
color: true
default: true
description: false
escape: true
hide-empty: false
html: true
indent: 2
lockfile: true
required: true
sensitive: true
type: true
183 changes: 2 additions & 181 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ remote_state {
generate "provider" {
path = "provider-aws.tf"
if_exists = "skip" # Allow modules to override provider settings
contents = <<EOF
contents = <<EOF
provider "aws" {
region = var.region

Expand Down
27 changes: 8 additions & 19 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,23 @@ module "aws_vpc" {
name = local.name
cidr = var.cidr

azs = var.azs
private_subnets = var.private_subnets
public_subnets = var.public_subnets
database_subnets = var.database_subnets
elasticache_subnets = var.elasticache_subnets
intra_subnets = var.intra_subnets

private_subnet_names = var.private_subnet_names
public_subnet_names = var.public_subnet_names
database_subnet_names = var.database_subnet_names
elasticache_subnet_names = var.elasticache_subnet_names
intra_subnet_names = var.intra_subnet_names
azs = var.azs
private_subnets = var.private_subnets
public_subnets = var.public_subnets
database_subnets = var.database_subnets

private_subnet_names = var.private_subnet_names
public_subnet_names = var.public_subnet_names
database_subnet_names = var.database_subnet_names

create_database_subnet_group = var.create_database_subnet_group
manage_default_network_acl = var.manage_default_network_acl
manage_default_route_table = var.manage_default_route_table
manage_default_security_group = var.manage_default_security_group

enable_dns_hostnames = var.enable_dns_hostnames
enable_dns_support = var.enable_dns_support

enable_nat_gateway = var.enable_nat_gateway
single_nat_gateway = var.single_nat_gateway

customer_gateways = var.customer_gateways

enable_vpn_gateway = var.enable_vpn_gateway

enable_dhcp_options = var.enable_dhcp_options
dhcp_options_domain_name = var.dhcp_options_domain_name
dhcp_options_domain_name_servers = var.dhcp_options_domain_name_servers
Expand Down
152 changes: 0 additions & 152 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -306,158 +306,6 @@ output "database_network_acl_arn" {
value = try(module.aws_vpc[0].database_network_acl_arn, null)
}

################################################################################
# Redshift Subnets
################################################################################

output "redshift_subnets" {
description = "List of IDs of redshift subnets"
value = module.aws_vpc[0].redshift_subnets
}

output "redshift_subnet_arns" {
description = "List of ARNs of redshift subnets"
value = module.aws_vpc[0].redshift_subnet_arns
}

output "redshift_subnets_cidr_blocks" {
description = "List of cidr_blocks of redshift subnets"
value = module.aws_vpc[0].redshift_subnets_cidr_blocks
}

output "redshift_subnets_ipv6_cidr_blocks" {
description = "List of IPv6 cidr_blocks of redshift subnets in an IPv6 enabled VPC"
value = module.aws_vpc[0].redshift_subnets_ipv6_cidr_blocks
}

output "redshift_subnet_group" {
description = "ID of redshift subnet group"
value = module.aws_vpc[0].redshift_subnet_group
}

output "redshift_route_table_ids" {
description = "List of IDs of redshift route tables"
value = module.aws_vpc[0].redshift_route_table_ids
}

output "redshift_route_table_association_ids" {
description = "List of IDs of the redshift route table association"
value = module.aws_vpc[0].redshift_route_table_association_ids
}

output "redshift_public_route_table_association_ids" {
description = "List of IDs of the public redshift route table association"
value = module.aws_vpc[0].redshift_public_route_table_association_ids
}

output "redshift_network_acl_id" {
description = "ID of the redshift network ACL"
value = module.aws_vpc[0].redshift_network_acl_id
}

output "redshift_network_acl_arn" {
description = "ARN of the redshift network ACL"
value = module.aws_vpc[0].redshift_network_acl_arn
}

################################################################################
# Elasticache Subnets
################################################################################

output "elasticache_subnets" {
description = "List of IDs of elasticache subnets"
value = module.aws_vpc[0].elasticache_subnets
}

output "elasticache_subnet_arns" {
description = "List of ARNs of elasticache subnets"
value = module.aws_vpc[0].elasticache_subnet_arns
}

output "elasticache_subnets_cidr_blocks" {
description = "List of cidr_blocks of elasticache subnets"
value = module.aws_vpc[0].elasticache_subnets_cidr_blocks
}

output "elasticache_subnets_ipv6_cidr_blocks" {
description = "List of IPv6 cidr_blocks of elasticache subnets in an IPv6 enabled VPC"
value = module.aws_vpc[0].elasticache_subnets_ipv6_cidr_blocks
}

output "elasticache_subnet_group" {
description = "ID of elasticache subnet group"
value = module.aws_vpc[0].elasticache_subnet_group
}

output "elasticache_subnet_group_name" {
description = "Name of elasticache subnet group"
value = module.aws_vpc[0].elasticache_subnet_group_name
}

output "elasticache_route_table_ids" {
description = "List of IDs of elasticache route tables"
value = module.aws_vpc[0].elasticache_route_table_ids
}

output "elasticache_route_table_association_ids" {
description = "List of IDs of the elasticache route table association"
value = module.aws_vpc[0].elasticache_route_table_association_ids
}

output "elasticache_network_acl_id" {
description = "ID of the elasticache network ACL"
value = module.aws_vpc[0].elasticache_network_acl_id
}

output "elasticache_network_acl_arn" {
description = "ARN of the elasticache network ACL"
value = module.aws_vpc[0].elasticache_network_acl_arn
}

################################################################################
# Intra Subnets
################################################################################

output "intra_subnets" {
description = "List of IDs of intra subnets"
value = module.aws_vpc[0].intra_subnets
}

output "intra_subnet_arns" {
description = "List of ARNs of intra subnets"
value = module.aws_vpc[0].intra_subnet_arns
}

output "intra_subnets_cidr_blocks" {
description = "List of cidr_blocks of intra subnets"
value = module.aws_vpc[0].intra_subnets_cidr_blocks
}

output "intra_subnets_ipv6_cidr_blocks" {
description = "List of IPv6 cidr_blocks of intra subnets in an IPv6 enabled VPC"
value = module.aws_vpc[0].intra_subnets_ipv6_cidr_blocks
}

output "intra_route_table_ids" {
description = "List of IDs of intra route tables"
value = module.aws_vpc[0].intra_route_table_ids
}

output "intra_route_table_association_ids" {
description = "List of IDs of the intra route table association"
value = module.aws_vpc[0].intra_route_table_association_ids
}

output "intra_network_acl_id" {
description = "ID of the intra network ACL"
value = module.aws_vpc[0].intra_network_acl_id
}

output "intra_network_acl_arn" {
description = "ARN of the intra network ACL"
value = module.aws_vpc[0].intra_network_acl_arn
}

################################################################################
# NAT Gateway
################################################################################
Expand Down
Loading