Skip to content

Commit

Permalink
fix: add label_order attribute for all modules (#44)
Browse files Browse the repository at this point in the history
* fix: add label_order attribute for all modules

* fix- tf-checks for output

* fix- remove terraform apply workflow

* fix- readme-action
  • Loading branch information
h1manshu98 committed Nov 7, 2023
1 parent 12fbd60 commit 3b8daf5
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 61 deletions.
34 changes: 27 additions & 7 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,49 @@
name: 'Create README.md file'
permissions: write-all

on:
push:
branches:
- master
paths:
- 'main.tf'
- 'variables.tf'
- 'outputs.tf'
- 'versions.tf'
workflow_dispatch:

jobs:
readme:

readme-create:

name: 'readme-create'
runs-on: ubuntu-latest

steps:
- name: 'Checkout'
- name: Updating GitHub Token
env:
GITHUB_TOKEN: ${{ secrets.GITHUB }}
run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV

- name: checkout
uses: actions/checkout@master
with:
fetch-depth: 0
ref: master
token: ${{ env.GH_TOKEN }}

- name: 'Set up Python 3.7'
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: 'create readme'
uses: 'clouddrove/github-actions@v9.0.3'
uses: 'clouddrove/github-actions@9.0.3'
with:
actions_subcommand: 'readme'
github_token: '${{ secrets.GITHUB }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB }}


- name: 'pre-commit check errors'
Expand All @@ -35,12 +55,12 @@ jobs:
continue-on-error: true

- name: 'push readme'
uses: 'clouddrove/github-actions@v9.0.3'
uses: 'clouddrove/github-actions@9.0.3'
continue-on-error: true
with:
actions_subcommand: 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB }}

- name: 'Slack Notification'
uses: clouddrove/action-slack@v2
Expand All @@ -49,6 +69,6 @@ jobs:
fields: repo,author
author_name: 'CloudDrove'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # required
GITHUB_TOKEN: ${{ secrets.GITHUB }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TERRAFORM }} # required
if: always()
21 changes: 0 additions & 21 deletions .github/workflows/terraform_workflow.yml

This file was deleted.

65 changes: 38 additions & 27 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# ------------------------------------------------------------------------------
##---------------------------------------------------------------------------------------------------------##
# Resources
# ------------------------------------------------------------------------------
locals {
label_order = var.label_order
}
##---------------------------------------------------------------------------------------------------------##

##----------------------------------------------VPC--------------------------------------------------------##
module "vpc" {
source = "clouddrove/vpc/aws"
version = "2.0.0"

name = "${var.name}-vpc"
environment = var.environment
label_order = var.label_order

enable = var.vpc_enable
name = "${var.name}-vpc"
environment = var.environment
cidr_block = var.cidr_block
enable_flow_log = var.enable_flow_log
flow_log_destination_type = var.flow_log_destination_type
Expand All @@ -27,9 +26,11 @@ module "subnet" {
source = "clouddrove/subnet/aws"
version = "2.0.0"

name = "${var.name}-subnet"
environment = var.environment
label_order = var.label_order

enable = var.subnet_enable
name = "${var.name}-subnet"
environment = var.environment
nat_gateway_enabled = var.nat_gateway_enabled
single_nat_gateway = var.single_nat_gateway
availability_zones = ["${var.region}a", "${var.region}b", "${var.region}c"]
Expand All @@ -48,9 +49,11 @@ module "ssh" {
source = "clouddrove/security-group/aws"
version = "2.0.0"

name = "${var.name}-ssh"
environment = var.environment
label_order = var.label_order

enable = var.sg_enable
name = "${var.name}-ssh"
environment = var.environment
vpc_id = module.vpc.vpc_id
prefix_list_enabled = true
entry = [{
Expand Down Expand Up @@ -82,10 +85,12 @@ module "tgw_hub" {
source = "clouddrove/transit-gateway/aws"
version = "2.0.0"

enable = var.tgw_hub_enable
name = "${var.name}-tgw"
environment = var.environment
label_order = var.label_order

depends_on = [module.vpc, module.subnet]
name = "${var.name}-tgw"
environment = var.environment
enable = var.tgw_hub_enable
tgw_create = var.tgw_hub_create
auto_accept_shared_attachments = var.tgw_hub_auto_accept_shared_attachments
description = var.tgw_hub_description
Expand All @@ -110,10 +115,12 @@ module "tgw_spoke" {
source = "clouddrove/transit-gateway/aws"
version = "2.0.0"

enable = var.tgw_spoke_enable
depends_on = [module.vpc, module.subnet]
name = "${var.name}-tgw"
environment = var.environment
label_order = var.label_order

depends_on = [module.vpc, module.subnet]
enable = var.tgw_spoke_enable
tgw_create = var.tgw_spoke_create
description = var.tgw_spoke_description
# -- TGW Share
Expand All @@ -140,6 +147,7 @@ module "acm" {

name = "${var.name}-certificate"
environment = var.environment
label_order = var.label_order

enable = var.acm_enable
domain_name = var.domain
Expand All @@ -152,28 +160,31 @@ module "route53" {
source = "clouddrove/route53/aws"
version = "1.0.2"

name = var.name
name = var.name
environment = var.environment
label_order = var.label_order

enabled = var.route53_enable
environment = var.environment
public_enabled = var.public_enabled
private_enabled = var.private_enabled

domain_name = var.domain
record_enabled = var.record_enabled
records = var.records
vpc_id = module.vpc.vpc_id
force_destroy = var.records_force_destroy
domain_name = var.domain
record_enabled = var.record_enabled
records = var.records
vpc_id = module.vpc.vpc_id
force_destroy = var.records_force_destroy
}

#----------------------------------------------VPN----------------------------------------------------##
module "vpn" {
source = "clouddrove/client-vpn/aws"
version = "1.0.7"

enabled = var.vpn_enable
name = "${var.name}-client-vpn"
environment = var.environment
label_order = var.label_order

depends_on = [module.vpc]
name = "${var.name}-client-vpn"
environment = var.environment
enabled = var.vpn_enable
split_tunnel_enable = var.split_tunnel_enable
cidr_block = var.vpn_cidr_block
vpc_id = module.vpc.vpc_id
Expand Down
5 changes: 0 additions & 5 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# ------------------------------------------------------------------------------
# Outputs
# ------------------------------------------------------------------------------
output "label_order" {
value = local.label_order
description = "Label order."
}

# ---------------------------------VPC------------------------------------------
output "vpc_id" {
value = module.vpc.vpc_id
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ------------------------------------------------------------------------------
variable "label_order" {
type = list(string)
default = ["name", "environment"]
default = ["environment", "name"]
description = "Label order, e.g. `name`,`environment`."
}

Expand Down

0 comments on commit 3b8daf5

Please sign in to comment.