Skip to content

Commit

Permalink
fix terraform lint and terraform fmt issues
Browse files Browse the repository at this point in the history
  • Loading branch information
velotioaastha committed Sep 4, 2024
1 parent 615043c commit 0b769ab
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 77 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/tf-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
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: Run tflint
run: tflint

- name: Check Terraform formatting
run: terraform fmt -check -recursive
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ module "wandb" {
host = local.url
license = var.license
cloudProvider = "azure"
bucket = local.bucket_config == null ? {
bucket = local.bucket_config == null ? {
provider = "az"
name = module.storage[0].account.name
path = "${module.storage[0].container.name}/${var.bucket_path}"
Expand Down
6 changes: 3 additions & 3 deletions modules/app_aks/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ locals {
}

resource "azurerm_role_assignment" "gateway" {
depends_on = [ local.ingress_gateway_principal_id ]
depends_on = [local.ingress_gateway_principal_id]
scope = var.gateway.id
role_definition_name = "Contributor"
principal_id = local.ingress_gateway_principal_id
}

resource "azurerm_role_assignment" "resource_group" {
depends_on = [ local.ingress_gateway_principal_id ]
depends_on = [local.ingress_gateway_principal_id]
scope = var.resource_group.id
role_definition_name = "Reader"
principal_id = local.ingress_gateway_principal_id
}

resource "azurerm_role_assignment" "public_subnet" {
depends_on = [ local.ingress_gateway_principal_id ]
depends_on = [local.ingress_gateway_principal_id]
scope = var.public_subnet.id
role_definition_name = "Contributor"
principal_id = local.ingress_gateway_principal_id
Expand Down
2 changes: 1 addition & 1 deletion modules/app_lb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ locals {
listener_name = "${var.network.name}-httplstn"
request_routing_rule_name = "${var.network.name}-rqrt"
redirect_configuration_name = "${var.network.name}-rdrcfg"
app_gateway_name = var.private_link ? "${var.namespace}-ag-private-link" : "${var.namespace}-ag"
app_gateway_name = var.private_link ? "${var.namespace}-ag-private-link" : "${var.namespace}-ag"
}


Expand Down
2 changes: 1 addition & 1 deletion modules/app_lb/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ variable "private_subnet" {
}

variable "private_link" {
type = bool
type = bool
description = "Specifies the Azure private link creation"
}
8 changes: 4 additions & 4 deletions modules/clickhouse/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ locals {
}

resource "azurerm_private_endpoint" "clickhouse" {
name = "${var.namespace}-clickhouse-pe"
location = var.location
resource_group_name = var.resource_group_name
subnet_id = var.private_subnet_id
name = "${var.namespace}-clickhouse-pe"
location = var.location
resource_group_name = var.resource_group_name
subnet_id = var.private_subnet_id
custom_network_interface_name = "${var.namespace}-clickhouse-nic"

private_service_connection {
Expand Down
4 changes: 2 additions & 2 deletions modules/clickhouse/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ variable "clickhouse_private_endpoint_service_name" {
default = ""

validation {
condition = can(regex("\\.azure\\.privatelinkservice$", var.clickhouse_private_endpoint_service_name))
condition = can(regex("\\.azure\\.privatelinkservice$", var.clickhouse_private_endpoint_service_name))
error_message = "ClickHouse Service name must end in '.azure.privatelinkservice'."
}
}
Expand All @@ -40,7 +40,7 @@ variable "clickhouse_region" {
default = ""

validation {
condition = length(var.clickhouse_region) > 0
condition = length(var.clickhouse_region) > 0
error_message = "Clickhouse Region should always be set if the private endpoint service name is specified."
}
}
8 changes: 4 additions & 4 deletions modules/networking/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ resource "azurerm_virtual_network" "default" {
}

resource "azurerm_subnet" "private" {
name = "${var.namespace}-private"
resource_group_name = var.resource_group_name
address_prefixes = [var.network_private_subnet_cidr]
virtual_network_name = azurerm_virtual_network.default.name
name = "${var.namespace}-private"
resource_group_name = var.resource_group_name
address_prefixes = [var.network_private_subnet_cidr]
virtual_network_name = azurerm_virtual_network.default.name
private_link_service_network_policies_enabled = var.private_link ? false : true

service_endpoints = concat(
Expand Down
2 changes: 1 addition & 1 deletion modules/networking/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ variable "tags" {
}

variable "private_link" {
type = bool
type = bool
description = "Private link flag for multi region storage endpoint access"
}

Expand Down
60 changes: 0 additions & 60 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,59 +35,17 @@ variable "size" {
type = string
}

variable "wandb_version" {
description = "The version of Weights & Biases local to deploy."
type = string
default = "latest"
}

variable "wandb_image" {
description = "Docker repository of to pull the wandb image from."
type = string
default = "wandb/local"
}

variable "license" {
type = string
description = "Your wandb/local license"
}

variable "oidc_issuer" {
type = string
description = "A url to your Open ID Connect identity provider, i.e. https://cognito-idp.us-east-1.amazonaws.com/us-east-1_uiIFNdacd"
default = ""
}

variable "oidc_client_id" {
type = string
description = "The Client ID of application in your identity provider"
default = ""
}

variable "oidc_secret" {
type = string
description = "The Client secret of application in your identity provider"
default = ""
sensitive = true
}

variable "oidc_auth_method" {
type = string
description = "OIDC auth method"
default = "implicit"
validation {
condition = contains(["pkce", "implicit"], var.oidc_auth_method)
error_message = "Invalid OIDC auth method."
}
}

variable "other_wandb_env" {
type = map(any)
description = "Extra environment variables for W&B"
default = {}
}


##########################################
# DNS #
##########################################
Expand Down Expand Up @@ -138,12 +96,6 @@ variable "database_sku_name" {
##########################################
# Redis #
##########################################
variable "create_redis" {
type = bool
description = "Boolean indicating whether to provision an redis instance (true) or not (false)."
default = false
}

variable "redis_capacity" {
type = number
description = "Number indicating size of an redis instance"
Expand Down Expand Up @@ -248,18 +200,6 @@ variable "allowed_ip_ranges" {
default = []
}

variable "weave_wandb_env" {
type = map(string)
description = "Extra environment variables for W&B"
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"
Expand Down

0 comments on commit 0b769ab

Please sign in to comment.