hashicorp / hashicorp/tfc-workflows-github
Error: Variables not allowed
- Vorherrschende Sprache
- HCL
- Sterne
- 178
- Forks
- 30
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I'm struggling to pass in a variable at runtime.
I used the [learn tfc tutorial](https://github.com/hashicorp/learn-terraform-cloud) to get a basic project going.
The projects works fine, when declaring variable in the interface, but it doesn't work at all, when trying to pass them in via en variables.
I modified the 'main.tf' file:
```
variable "access_key" {
description = "value of AWS access key"
type = string
default = null
}
variable "secret_key" {
description = "value of AWS secret key"
type = string
default = null
}
provider "aws" {
region = "us-west-2"
access_key = var.access_key
secret_key = var.secret_key
}
```
And try to run tf in an action:
```
- name: Create Plan Run
uses: hashicorp/tfc-workflows-github/actions/create-run@v1.0.0
id: plan-run
with:
workspace: ${{ env.TF_WORKSPACE }}
configuration_version: ${{ steps.plan-upload.outputs.configuration_version_id }}
plan_only: true
env:
TF_VAR_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }}
TF_VAR_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
```
However in the tfc console I receive the error:
```
2023-08-30T12:12:41.859Z [DEBUG] backend/local: Skipping interactive prompts for variables because input is disabled
╷
│ Error: Variables not allowed
│
│ on /home/tfc-agent/.tfc-agent/component/terraform/runs/run-uGHGZhRqc5VVoXhU/terraform.tfvars line 1:
│ 1: access_key = xxx
│
│ Variables may not be used here.
╵
Operation failed: failed running terraform plan (exit 1)
```
Am I missing something?
Beitragsleitfaden
Rechercherichtung
Beginne mit main.tf und dem create-run-Workflow-Schritt unter Verwendung von hashicorp/tfc-workflows-github/actions/create-run@v1.0.0; untersuche, wie der Workflow TF_VAR_access_key und TF_VAR_secret_key an den Terraform Cloud run übergibt. Reproduziere den Plan und bestätige, dass Laufzeitvariablen ohne den Fehler „Variables not allowed“ akzeptiert werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- github-actions, terraform
- Bereich
- ci-cd, cloud
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100