Skip to content

Commit

Permalink
feat: (IAC-1078) Linting Updates and Code Formatting (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
jarpat authored and dhoucgitter committed Feb 14, 2024
1 parent c194ce8 commit 8db865c
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 41 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/linter-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Linter Analysis

on:
push:
branches: ['*'] # '*' will cause the workflow to run on all commits to all branches.
branches: [ '**' ] # '**' will cause the workflow to run on all commits to all branches, including those with path separators

jobs:
# Hadolint: Job-1
Expand Down Expand Up @@ -54,8 +54,15 @@ jobs:
tflint_version: latest
github_token: ${{ secrets.LINTER_TEST_TOKEN }}

# Necessary so we can recursively tflint our modules folder
# with the plugin, not needed for regular project use.
- name: Initializing modules
run: |
terraform -chdir=modules/aws_autoscaling init
terraform -chdir=modules/aws_ebs_csi init
- name: Initializing TFLint
run: TFLINT_LOG=info tflint --init -c .tflint.hcl
run: TFLINT_LOG=info tflint --init -c "$(pwd)/linting-configs/.tflint.hcl"

- name: Run TFLint Action
run: TFLINT_LOG=info tflint -c .tflint.hcl
run: TFLINT_LOG=info tflint -c "$(pwd)/linting-configs/.tflint.hcl" --recursive
2 changes: 1 addition & 1 deletion linting-configs/.tflint.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config {

plugin "aws" {
enabled = true
version = "0.23.0"
version = "0.27.0"
source = "github.com/terraform-linters/tflint-ruleset-aws"
}

Expand Down
68 changes: 47 additions & 21 deletions modules/aws_vm/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# SPDX-License-Identifier: Apache-2.0

variable "name" {
type = string
description = "Name to assign the VM"
type = string
}

variable "tags" {
Expand All @@ -12,77 +13,102 @@ variable "tags" {
}

variable "vm_type" {
default = "m5.4xlarge"
description = "EC2 instance type"
type = string
default = "m5.4xlarge"
}

variable "cloud_init" {
default = ""
}

variable "postgres_administrator_login" {
description = "The Administrator Login for the PostgreSQL Server. Changing this forces a new resource to be created."
default = "pgadmin"
description = "Cloud init script to execute"
type = string
default = ""
}

variable "vm_admin" {
description = "OS Admin User for VMs of AKS Cluster nodes"
description = "OS Admin User for VMs of EC2 instance"
type = string
default = "azureuser"
}

variable "ssh_public_key" {
description = "Path to ssh public key"
type = string
default = ""
}

variable "security_group_ids" {
default = []
description = "List of security group ids to associate with the EC2 instance"
type = list(string)
default = []
}

variable "create_public_ip" {
default = false
description = "Toggle the creation of a public EIP to be associated with the EC2 instance"
type = bool
default = false
}

variable "data_disk_count" {
default = 0
description = "Number of disks to attach to the EC2 instance"
type = number
default = 0
}

variable "data_disk_size" {
default = 128
description = "Size of disk to attach to the EC2 instance in GiBs"
type = number
default = 128
}

variable "data_disk_type" {
default = "gp3"
description = "The type of EBS volume for the data disk"
type = string
default = "gp3"
}

variable "data_disk_availability_zone" {
default = ""
description = "The AZ where the EBS volume will exist"
type = string
default = ""
}

variable "data_disk_iops" {
default = 0
description = "The amount of IOPS to provision for the data disk"
type = number
default = 0
}

variable "os_disk_size" {
default = 64
description = "The size of the OS disk"
type = number
default = 64
}

variable "os_disk_type" {
default = "standard"
description = "The type of EBS volume for the OS disk"
type = string
default = "standard"
}

variable "os_disk_delete_on_termination" {
default = true
description = "Delete disk on termination"
type = bool
default = true
}

variable "os_disk_iops" {
default = 0
description = "The amount of IOPS to provision for the OS disk"
type = number
default = 0
}

variable "subnet_id" {
type = string
description = "The VPC Subnet ID to launch in."
type = string
}

variable "enable_ebs_encryption" {
description = "Enable encryption on EBS volumes."
type = bool
default = false
}
2 changes: 1 addition & 1 deletion modules/aws_vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ locals {
existing_private_subnets = local.existing_subnets && contains(keys(var.existing_subnet_ids), "private") ? (length(var.existing_subnet_ids["private"]) > 0 ? true : false) : false
existing_database_subnets = local.existing_subnets && contains(keys(var.existing_subnet_ids), "database") ? (length(var.existing_subnet_ids["database"]) > 0 ? true : false) : false

public_subnets = local.existing_public_subnets ? data.aws_subnet.public : aws_subnet.public
# public_subnets = local.existing_public_subnets ? data.aws_subnet.public : aws_subnet.public # not used keeping for ref
private_subnets = local.existing_private_subnets ? data.aws_subnet.private : aws_subnet.private

}
Expand Down
19 changes: 4 additions & 15 deletions modules/aws_vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ variable "azs" {

variable "vpc_id" {
description = "Existing vpc id"
type = string
default = null
}

variable "name" {
type = string
default = null
description = "Prefix used when creating VPC resources"
type = string
default = null
}

variable "cidr" {
Expand All @@ -39,18 +41,6 @@ variable "existing_nat_id" {
description = "Pre-existing VPC NAT Gateway id"
}

variable "enable_nat_gateway" {
description = "Should be true if you want to provision NAT Gateways for each of your private networks"
type = bool
default = true
}

variable "single_nat_gateway" {
description = "Should be true if you want to provision a single shared NAT Gateway across all of your private networks"
type = bool
default = true
}

variable "enable_dns_hostnames" {
description = "Should be true to enable DNS hostnames in the VPC"
type = bool
Expand All @@ -63,7 +53,6 @@ variable "enable_dns_support" {
default = true
}


variable "tags" {
description = "The tags to associate with your network and subnets."
type = map(string)
Expand Down
File renamed without changes.
5 changes: 5 additions & 0 deletions modules/kubeconfig/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ variable "namespace" {
}

variable "region" {
description = "AWS Region this cluster was provisioned in"
type = string
default = null
}
Expand All @@ -24,17 +25,21 @@ variable "create_static_kubeconfig" {
}

variable "path" {
description = "Path to output the kubeconfig file"
type = string
}

variable "cluster_name" {
description = "Kubernetes cluster name"
type = string
}

variable "endpoint" {
description = "Kubernetes cluster endpoint"
type = string
}

variable "ca_crt" {
description = "Kubernetes CA certificate"
type = string
}

0 comments on commit 8db865c

Please sign in to comment.