diff --git a/.github/workflows/linter-analysis.yaml b/.github/workflows/linter-analysis.yaml index 3620bd64..b4454d04 100644 --- a/.github/workflows/linter-analysis.yaml +++ b/.github/workflows/linter-analysis.yaml @@ -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 @@ -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 diff --git a/linting-configs/.tflint.hcl b/linting-configs/.tflint.hcl index 8a125a87..7b6e4873 100644 --- a/linting-configs/.tflint.hcl +++ b/linting-configs/.tflint.hcl @@ -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" } diff --git a/modules/aws_vm/variables.tf b/modules/aws_vm/variables.tf index 88a7c030..8121de5d 100644 --- a/modules/aws_vm/variables.tf +++ b/modules/aws_vm/variables.tf @@ -2,7 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 variable "name" { - type = string + description = "Name to assign the VM" + type = string } variable "tags" { @@ -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 = "gp2" + description = "The type of EBS volume for the data disk" + type = string + default = "gp2" } 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 } diff --git a/modules/aws_vpc/main.tf b/modules/aws_vpc/main.tf index a0463bb9..7817ff4a 100644 --- a/modules/aws_vpc/main.tf +++ b/modules/aws_vpc/main.tf @@ -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 } diff --git a/modules/aws_vpc/variables.tf b/modules/aws_vpc/variables.tf index 3e035270..3b2b272a 100644 --- a/modules/aws_vpc/variables.tf +++ b/modules/aws_vpc/variables.tf @@ -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" { @@ -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 @@ -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) diff --git a/modules/kubeconfig/output.tf b/modules/kubeconfig/outputs.tf similarity index 100% rename from modules/kubeconfig/output.tf rename to modules/kubeconfig/outputs.tf diff --git a/modules/kubeconfig/variables.tf b/modules/kubeconfig/variables.tf index 71a2dbda..45575e7e 100644 --- a/modules/kubeconfig/variables.tf +++ b/modules/kubeconfig/variables.tf @@ -13,6 +13,7 @@ variable "namespace" { } variable "region" { + description = "AWS Region this cluster was provisioned in" type = string default = null } @@ -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 }