Skip to content

Problem: Survery Variables are not passed during Tofu Init #2554

@allancassaro

Description

@allancassaro

Issue

Survery Variables are not passed during Terraform/Tofu Init.

With OpenTofu starting from version 1.8.X, it is possible to pass variables to any part of the execution.
In my case this is specially helpful to define the backend location.

This is a sample of my .tf file:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
  backend "s3" {
    bucket = "test"
    key    = replace(var.test_name, "/", "-")
    region = var.region
  }
}

I can define the backend location using a variable test_name, like this:

tofu init -var test_name=test_one

The Survey Variables are passed along on all other commands, except the init, what causes errors.

Impact

Other

Installation method

Docker

Database

MySQL, BoltDB, Postgres

Browser

Firefox, Chrome, Safari

Semaphore Version

Version: v2.10.35-a71a3c5-1730103926

Ansible Version

No response

Logs & errors

Error: Backend initialization required: please run "tofu init"

Manual installation - system information

No response

Configuration

No response

Additional information

I can workaround this issue passing environment variables such as TF_VAR_test_name=test_one, but this is very annoying and not user friendly.

Would it be much better if the Survey Variables were passed along the init command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions