diff --git a/.github/workflows/tf-lint.yaml b/.github/workflows/tf-lint.yaml new file mode 100644 index 00000000..93e4e181 --- /dev/null +++ b/.github/workflows/tf-lint.yaml @@ -0,0 +1,36 @@ +name: Terraform Lint and Format Check + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + terraform_checks: + name: Run Terraform Lint and Format Check + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Terraform + uses: hashicorp/setup-terraform@v1 + with: + terraform_version: "~1" + + - name: Install tflint + run: | + curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash + + - name: Initialize TFLint + run: tflint --init + + - name: Run tflint + run: tflint + + - name: Check Terraform formatting + run: terraform fmt -check -recursive diff --git a/.tflint.hcl b/.tflint.hcl deleted file mode 100644 index 22c4bb2e..00000000 --- a/.tflint.hcl +++ /dev/null @@ -1,9 +0,0 @@ -config { - module = true -} - -plugin "aws" { - enabled = true - version = "0.7.2" - source = "github.com/terraform-linters/tflint-ruleset-aws" -} \ No newline at end of file diff --git a/main.tf b/main.tf index bbdf9f24..4b42b080 100644 --- a/main.tf +++ b/main.tf @@ -39,8 +39,8 @@ module "file_storage" { } locals { - bucket_name = local.use_external_bucket ? var.bucket_name : module.file_storage.0.bucket_name - bucket_queue_name = local.use_internal_queue ? null : module.file_storage.0.bucket_queue_name + bucket_name = local.use_external_bucket ? var.bucket_name : module.file_storage[0].bucket_name + bucket_queue_name = local.use_internal_queue ? null : module.file_storage[0].bucket_queue_name } module "networking" { @@ -58,13 +58,12 @@ module "networking" { } locals { - network_id = var.create_vpc ? module.networking.vpc_id : var.network_id - network_public_subnets = var.create_vpc ? module.networking.public_subnets : var.network_public_subnets - + network_id = var.create_vpc ? module.networking.vpc_id : var.network_id network_private_subnets = var.create_vpc ? module.networking.private_subnets : var.network_private_subnets network_private_subnet_cidrs = var.create_vpc ? module.networking.private_subnet_cidrs : var.network_private_subnet_cidrs - network_database_subnets = var.create_vpc ? module.networking.database_subnets : var.network_database_subnets + network_database_subnets = var.create_vpc ? module.networking.database_subnets : var.network_database_subnets + # tflint-ignore: terraform_unused_declarations network_database_subnet_cidrs = var.create_vpc ? module.networking.database_subnet_cidrs : var.network_database_subnet_cidrs network_database_create_subnet_group = !var.create_vpc network_database_subnet_group_name = var.create_vpc ? module.networking.database_subnet_group_name : "${var.namespace}-database-subnet" @@ -129,8 +128,6 @@ locals { acm_certificate_arn = local.create_certificate ? module.acm.acm_certificate_arn : var.acm_certificate_arn url = local.acm_certificate_arn == null ? "http://${local.fqdn}" : "https://${local.fqdn}" domain_filter = var.custom_domain_filter == null || var.custom_domain_filter == "" ? local.fqdn : var.custom_domain_filter - - internal_app_port = 32543 } module "app_eks" { @@ -155,7 +152,7 @@ module "app_eks" { ]) bucket_arn = data.aws_s3_bucket.file_storage.arn - bucket_sqs_queue_arn = local.use_internal_queue ? null : data.aws_sqs_queue.file_storage.0.arn + bucket_sqs_queue_arn = local.use_internal_queue ? null : data.aws_sqs_queue.file_storage[0].arn network_id = local.network_id network_private_subnets = local.network_private_subnets @@ -164,7 +161,7 @@ module "app_eks" { database_security_group_id = module.database.security_group_id create_elasticache_security_group = var.create_elasticache - elasticache_security_group_id = var.create_elasticache ? module.redis.0.security_group_id : null + elasticache_security_group_id = var.create_elasticache ? module.redis[0].security_group_id : null cluster_version = var.eks_cluster_version cluster_endpoint_public_access = var.kubernetes_public_access @@ -287,8 +284,8 @@ module "wandb" { } redis = { - host = module.redis.0.host - port = "${module.redis.0.port}?tls=true&ttlInSeconds=604800" + host = module.redis[0].host + port = "${module.redis[0].port}?tls=true&ttlInSeconds=604800" } } diff --git a/outputs.tf b/outputs.tf index 0ba20283..cd5f0d46 100644 --- a/outputs.tf +++ b/outputs.tf @@ -36,7 +36,7 @@ output "database_instance_type" { } output "elasticache_connection_string" { - value = var.create_elasticache ? module.redis.0.connection_string : null + value = var.create_elasticache ? module.redis[0].connection_string : null } output "eks_min_nodes_per_az" { diff --git a/variables.tf b/variables.tf index 2113f8dd..2740aa31 100644 --- a/variables.tf +++ b/variables.tf @@ -77,18 +77,6 @@ variable "database_master_username" { default = "wandb" } -variable "database_binlog_format" { - description = "Specifies the binlog_format value to set for the database" - type = string - default = "ROW" -} - -variable "database_innodb_lru_scan_depth" { - description = "Specifies the innodb_lru_scan_depth value to set for the database" - type = number - default = 128 -} - variable "database_performance_insights_kms_key_arn" { default = "" description = "Specifies an existing KMS key ARN to encrypt the performance insights data if performance_insights_enabled is was enabled out of band" @@ -154,12 +142,6 @@ variable "extra_fqdn" { ########################################## # Load Balancer # ########################################## -variable "ssl_policy" { - type = string - default = "ELBSecurityPolicy-FS-1-2-Res-2020-10" - description = "SSL policy to use on ALB listener" -} - variable "acm_certificate_arn" { type = string default = null @@ -238,12 +220,6 @@ variable "network_private_subnets" { type = list(string) } -variable "network_public_subnets" { - default = [] - description = "A list of the identities of the public subnetworks in which resources will be deployed." - type = list(string) -} - variable "network_database_subnets" { default = [] description = "A list of the identities of the database subnetworks in which resources will be deployed." @@ -518,12 +494,6 @@ variable "weave_wandb_env" { default = {} } -variable "app_wandb_env" { - type = map(string) - description = "Extra environment variables for W&B" - default = {} -} - variable "parquet_wandb_env" { type = map(string) description = "Extra environment variables for W&B"