Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How to use map of strings variables on Terraform from Semaphore #2619

Open
Davacg opened this issue Dec 10, 2024 · 0 comments
Open
Labels

Comments

@Davacg
Copy link

Davacg commented Dec 10, 2024

Question

I have set up Git integration on the Semaphore server and added the repositories where I have the Terraform files (main, tfvars, etc.). In the tfvars file, I have added the variables that will be used when Terraform is launched. When I configure the environment variables in the 'Environment Variables' section, they are applied without issues and execute the ones I have modified instead of the default ones in the tfvars file (desired behavior).

The problem arises when I try to modify variables of type 'map of string,' where I encounter the following error: 'add screenshot.'

2024-12-10_12-45

2024-12-10_12-47

I have tried adding them as JSON in the environment variables and also in table form, but I have not been able to get them to work in any case. For this type of variable, it uses the default values in the template.

If I run the Terraform task without modifying the variables of type "map of string," it executes correctly using the default values from the tfvars file.

2024-12-10_12-48

The Terraform files in the Git repositories are 'templates' to be launched later with the modifications made from Semaphore, so it is crucial to be able to modify these map of string fields.

What am I doing wrong? Is there any way to pass this type of variable?

Example of JSON configuration in environment variables:

{
"region": "eu-west-1",
"vpc_id": "vpc-xxxxxxx",
"create_instance_sg": "true",
"instance_key_name": "keypair-semaphore-test",
"instance_type": "t2.micro",
"instance_name": "ec2-semaphore-test",
"instance_subnet_id": "subnet-xxxxx",
"tags": {
"Department": "E-02000"
}
}

Related to

No response

@Davacg Davacg changed the title Question: use map of strings variables on Terraform from Semaphore Question: How to use map of strings variables on Terraform from Semaphore Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant