diff --git a/.github/workflows/terraform.yaml b/.github/workflows/terraform.yaml new file mode 100644 index 00000000..f161c712 --- /dev/null +++ b/.github/workflows/terraform.yaml @@ -0,0 +1,30 @@ +name: Check the Terraform Module + +on: + pull_request: + paths: + - '**.tf' + +jobs: + build: + name: Terraform Checks and Plans + runs-on: ubuntu-latest + steps: + - name: Checkout the repository to the runner + uses: actions/checkout@v3 + + - name: HashiCorp - Setup Terraform + uses: hashicorp/setup-terraform@v3 + + - name: Terraform Format + id: fmt + run: terraform fmt -recursive -check + continue-on-error: true + + - name: Terraform Init + id: init + run: terraform init + + - name: Terraform Validate + id: validate + run: terraform validate -no-color \ No newline at end of file diff --git a/terraform/README.md b/terraform/README.md index 52f4669a..271da445 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -41,13 +41,13 @@ Replace the values in the `terraform.tfvars` file: model_name = "put your model-name here" ``` -Run Terraform Plan by providing var-file: +Create the Terraform Plan: ```console terraform plan -var-file="terraform.tfvars" ``` -Deploy the resources, skip the approval: +Deploy the resources: ```console terraform apply -auto-approve @@ -63,7 +63,7 @@ juju status --relations ### Clean Up -Remove the application: +Destroy the deployment: ```console terraform destroy -auto-approve diff --git a/terraform/terraform.tf b/terraform/terraform.tf index 545a7bb5..4f60bb46 100644 --- a/terraform/terraform.tf +++ b/terraform/terraform.tf @@ -1,4 +1,4 @@ -# Copyright 2023 Canonical Ltd. +# Copyright 2024 Canonical Ltd. # See LICENSE file for licensing details. terraform { diff --git a/terraform/terraform.tfvars b/terraform/terraform.tfvars index c825ef1c..ce13cb66 100644 --- a/terraform/terraform.tfvars +++ b/terraform/terraform.tfvars @@ -2,7 +2,7 @@ model_name = "put your model-name here" # Optional Configuration -channel = "put the charm channel here" +channel = "put the Charm channel here" metrics_remote_write_offer_url = "Put the URL here" logging_offer_url = "Put the URL here" grafana-config = {