diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml new file mode 100644 index 0000000..bc0bc03 --- /dev/null +++ b/.github/workflows/terraform.yaml @@ -0,0 +1,25 @@ +name: terraform + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + branches: + - main + workflow_dispatch: + +jobs: + terraform: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Init + run: terraform init + + - name: Linting + run: terraform fmt -recursive -check + + - name: Validate + run: terraform validate \ No newline at end of file diff --git a/README.md b/README.md index 5db90d3..dc6abff 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # homelab +[![terraform](https://github.com/guyzsarun-lab/homelab/actions/workflows/terraform.yaml/badge.svg)](https://github.com/guyzsarun-lab/homelab/actions/workflows/terraform.yaml) ## Components - [Kong](#kong-api-gateway) API Gateway diff --git a/kong/main.tf b/kong/main.tf index 8bd65a0..f02a347 100644 --- a/kong/main.tf +++ b/kong/main.tf @@ -1,8 +1,8 @@ output "route_k8s" { value = [ for route in kong-gateway_route.dynamic-app-route : { - id = route.id - name = route.name + id = route.id + name = route.name hosts = route.hosts[0] } ] @@ -11,7 +11,7 @@ output "route_k8s" { output "route_service" { value = [ for service in kong-gateway_route.dynamic-service-route : { - id = service.id + id = service.id name = service.name host = service.hosts[0] } diff --git a/kong/plugin.tf b/kong/plugin.tf index a327c56..b1d1f31 100644 --- a/kong/plugin.tf +++ b/kong/plugin.tf @@ -8,8 +8,8 @@ resource "kong-gateway_plugin_prometheus" "prometheus" { } enabled = true - instance_name = "prometheus-metrics" + instance_name = "prometheus-metrics" protocols = [ - "https","http" + "https", "http" ] } \ No newline at end of file diff --git a/kong/route_service.tf b/kong/route_service.tf index 00e2f0a..efbf7db 100644 --- a/kong/route_service.tf +++ b/kong/route_service.tf @@ -20,7 +20,7 @@ resource "kong-gateway_route" "dynamic-service-route" { for_each = { for service in local.service_route : service.name => service } name = "${each.value.name}-route" - protocols = ["http","https"] + protocols = ["http", "https"] hosts = [each.value.host] paths = [] preserve_host = true