I tried Terraform with Proxmox and it's working fine. Trying to learn and utilize the GitHub action feature with self-hosted github runner
name: LCX_2
on:
workflow_dispatch:
env:
PM_API_URL: ${{ secrets.PM_API_URL }}
PM_API_TOKEN_ID: ${{ secrets.PM_API_TOKEN_ID }}
PM_API_TOKEN_SECRET: ${{ secrets.PM_API_TOKEN_SECRET }}
ROOT_CT_PASSW: ${{ secrets.ROOT_CT_PASSW }}
PM_TLS_INSECURE: ${{ secrets.PM_TLS_INSECURE }}
jobs:
terraform:
runs-on: "self-hosted"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Plan
id: plan
run: terraform plan -no-color
On plan, it's giving an error even though I have set the secrets in the repo. Can anyone guide or point out a reference, please
with provider["registry.terraform.io/terraform-for-proxmox/proxmox"],
on provider.tf line 12, in provider "proxmox":
12: pm_api_url = var.pm_api_url
Planning failed. Terraform encountered an error while generating this plan.
Assigning values in the shell environment for input to Terraform variables requires prefixing the key with
TF_VAR_. There is a short section in the documentation about this. Therefore theenvkeys in your GH Actions config file need a corresponding prefix. Also, there is a case typo in the keys where they are all uppercase whereas according to the error message the declared variable is lowercase:where I have assumed all environment variables map to declared Terraform input variables similar to the one presented in the error message because the declaration configs are absent from the question. Refrain from modifying any keys where this is not true.