Skip to content

Commit

Permalink
Add the Github workflow for the Terraform checks
Browse files Browse the repository at this point in the history
Signed-off-by: gatici <[email protected]>
  • Loading branch information
gatici committed Feb 6, 2024
1 parent becd9d3 commit a6982ec
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 102 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/terraform.yaml
Original file line number Diff line number Diff line change
@@ -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
86 changes: 0 additions & 86 deletions terraform/CONTRIBUTING.md

This file was deleted.

14 changes: 6 additions & 8 deletions terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This Grafana-agent-k8s Terraform module aims to deploy the [grafana-agent-k8s ch

### Prerequisites

The following software and tools needs to be installed and should be running in the local environment.
The following software and tools needs to be installed and should be running in the local environment. Please [set up your environment](https://discourse.charmhub.io/t/set-up-your-development-environment-with-microk8s-for-juju-terraform-provider/13109) before deployment.

- `microk8s`
- `juju 3.x`
Expand All @@ -23,7 +23,7 @@ sudo microk8s enable hostpath-storage
Add a Juju model:

```console
juju add model <model-name>
juju add-model <model-name>
```

Initialise the provider:
Expand All @@ -32,22 +32,20 @@ Initialise the provider:
terraform init
```

Customize the configuration inputs under `terraform.tfvars` file according to requirement.

Replace the values in the `terraform.tfvars` file:
Fill the mandatory config options in the `terraform.tfvars` file:

```yaml
# Mandatory Config Options
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
Expand All @@ -63,7 +61,7 @@ juju status --relations

### Clean Up

Remove the application:
Destroy the deployment:

```console
terraform destroy -auto-approve
Expand Down
2 changes: 1 addition & 1 deletion terraform/terraform.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 Canonical Ltd.
# Copyright 2024 Canonical Ltd.
# See LICENSE file for licensing details.

terraform {
Expand Down
14 changes: 7 additions & 7 deletions terraform/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Mandatory Config Options
model_name = "put your model-name here"

# Optional Configuration
channel = "put the charm channel here"
metrics_remote_write_offer_url = "Put the URL here"
logging_offer_url = "Put the URL here"
grafana-config = {
tls_insecure_skip_verify = "put True not to skip the TLS verification"
}
# Optional Configuration.
# channel = "put the Charm channel here"
# metrics_remote_write_offer_url = "Put the URL here"
# logging_offer_url = "Put the URL here"
# grafana-config = {
# tls_insecure_skip_verify = "put True not to skip the TLS verification"
# }

0 comments on commit a6982ec

Please sign in to comment.