Questions tagged [terraform]

For questions about Terraform, an open source tool to maintain infrastructure.

Filter by
Sorted by
Tagged with
1
vote
1answer
27 views

Root ssh key for ansible control node

Scenario: Deploy 30 VMs using terraform and then run ansible - how many ssh keys do you generate? Virtual machine definition in terraform requires administrator ssh key or password provided. Do you ...
0
votes
1answer
16 views

Terraform import and using ip address as attribute name

I am building terrform.tfstate files from Terraform managed Fortigate devices. After producing output JSON files using Terraform output and a custom script to produce tf.address.tf.json, I wish to ...
2
votes
1answer
49 views

Terraform apply output only

I'm trying to apply only the output variable definition. Here is the "output" I want to apply. output "environment_information" { value = { foo = "value1" ...
1
vote
0answers
14 views

Native Terraform AWS Auto-Scaling Group Management with health Checks

I have been using CloudFormation for the past 3 years to manage AWS infrastructure which consists of multiple auto-scaling groups with immutable AMIs (amongst other things). I am trying to rewrite ...
1
vote
1answer
20 views

Using counted data source in non-counted provider block in Terraform

I'm new to Terraform, I need suggestion about handling one case where I need to use data from counted data-source to un-counted provider. I need to fetch the gke-cluster context and pass it to ...
1
vote
3answers
33 views

Does it make sense to create CloudFormation Stack using Terraform?

I am not very familiar with AWS, but I know the basics. So please forgive me for any newbie mistakes in the question. I am trying to integrate our AWS accounts with a vendor app. The vendor has ...
0
votes
1answer
19 views

Resources don't seem to show up in Terraform state after import

I'm in the middle of importing a bunch of AWS resources into Terraform by doing the following: put a stub resource into a .tf file terraform import the resource (using the same address) copy the ...
1
vote
1answer
105 views

How to use kubernetes_service data provider in Terraform?

I have simple workflow. Create a cluster, install ingress with helm and once it's ready, get load balancer's IP address to update CF dns records. It's all in one script. After creating nginx-ingress ...
3
votes
1answer
77 views

Terraform: how do you inspect sensitive data?

In a resource of type aws_ecs_task_definition my plan has an line that looks like this: ~ container_definitions = (sensitive) # forces replacement Now in principle this could be doing anything - ...
0
votes
2answers
89 views

Do I have to include gitlab variables in my terraform code in order for my credentials to be recognized?

I am trying to set up a pipeline, which is supposed to deploy terraform code into an aws account. The code works fine locally, and I have setup and imported the state bucket and dynamodb table which ...
1
vote
1answer
50 views

How CircleCI, Terraform and AWS should interact in CI/CD Pipeline

I'm new to devops and I'm have a hard time finding resources to help me with this question. My Goal is to have an automated CI/CD pipeline to launch my project. Basically I have a GitHub repo with a ...
0
votes
1answer
36 views

Terrafrom to declare both infra and application deployment in one state

Are there any advantages of maintaining both infrastructure (Infra-as-code) and application/service (helm chart deployment using helm_release provider of terraform ) under one state file? I don't like ...
0
votes
2answers
40 views

How to get code onto aws ec2 instance using terraform and gitlabs

I've just started learning Terraform (utilizing the AWS provider) and I have managed to replicate our infrastructure which includes quite a few amazon web services. I can successfully deploy it and ...
1
vote
0answers
16 views

How Do I Get A Summary of Task Times With Terraform?

If I run ansible with profile_tasks I get a nice table at the end that shows me how long each task took. How can I get a similar summary at the end of running terraform apply?
2
votes
2answers
2k views

How do I use the remote-exec provisioner with Terraform?

I am using Terraform 0.14 and AWS. I am trying to write a .tf file that will invoke a remote-exec command via Terraform's provisioner. This code does not work: resource "aws_instance" "...
1
vote
1answer
90 views

Terragrunt Linter

I'm having troubles using HCL files at VSCode. When I open the HCL file the indentations are messy. So I fix it and close the file, when I open again...messy again... Someone know a add-ons to works ...
1
vote
1answer
198 views

How do I enable Google App Engine API with Terraform?

I'm attempting to enable the AppEngine service via Terraform but I'm getting an error: Error: Error creating App Engine application: googleapi: Error 403: App Engine Admin API has not been used in ...
0
votes
1answer
181 views

Enable/disable resource in terraform using count

I added a piece of code to support enable/disable to the feature - I used the count. Now I have the following problem: ERROR: on modules/eventhub/main.tf line 110, in resource "azurerm_eventhub&...
1
vote
0answers
20 views

How to test pipeline changes in Azure?

I currently have a pipeline in Azure which consists of a bunch of YAML which eventually calls some terraform script to handle the deployment side. What is the best way to handle dev testing of changes ...
1
vote
1answer
241 views

What does “eksctl create iamserviceaccount” do under the hood on an EKS cluster?

AWS supports IAM Roles for Service Accounts (IRSA) that allows cluster operators to map AWS IAM Roles to Kubernetes Service Accounts. To do so, one has to create an iamserviceaccount in an EKS cluster:...
1
vote
1answer
158 views

Is it possible to have an aws EKS infrastructure as code?

Is it possible to declare "a complete production level EKS with other aws services" using terraform? I know that terraform has an eks module and an aws provider. But I'm not sure if one can ...
1
vote
1answer
46 views

How can I add another module to my existing Terraform deployment plan?

I have deployed a project within Terraform. I need to add a 4th application module to my existing plan. How do I update my plan to include this 4th module and deploy the missing module without ...
4
votes
2answers
68 views

Are there automated quality checking tools for Ops code

In the dev world, we have several tools available to us for automated quality checks. We have unit tests that run on each build, Sonar to check for code quality, metrics being sent to Grafana and ...
1
vote
1answer
57 views

IaC Deployment in Azure with Terraform + Chef vs. Puppet vs. Ansible for Data Engineers

I am an Azure Data Engineer and try to leverage the IaC benefits in this area of Azure Data Factory, Azure Databricks, Azure SQL & Synapse, Azure Power BI, Azure IoT. After some research I figured ...
3
votes
1answer
502 views

Terraform variable Validation

is it possible to use validation of a variable type equals list(string)? My example: main.tf name = "tf-prd-sg-foo" image_id = "ami-00e788542ee66c64f" ...
1
vote
1answer
487 views

Terraform - gitlab provider does not start

I am using terraform docker image hashicorp/terraform:latest and I define the provider in main.tf as follows: terraform { required_providers { gitlab = { source = "gitlabhq/gitlab&...
1
vote
0answers
18 views

Define a repo logo via terraform github_repository

Is there a way to give my terraformed github_repository a custom logo? The doc doesn't have a field for it, but is there an undocumented feature? Branding is important!
1
vote
1answer
117 views

Using a combination of Terraform and Ansible to create dynamic AWS EC2 infrastructure

The company I work for wants to prevent provider lock-in adn therefore told us to use Terraform+Ansible instead of Cloudformation. We already decided to use terragrunt as an addon. While the ...
2
votes
1answer
408 views

Terraform ignore_changes block on JSON-encoded attribute

I'm currently trying to get CloudWatch logging and DMS configuration working smoothly in my module by ignoring certain attributes on replication_task_settings. Right now, I have a DMS replication task ...
1
vote
1answer
13 views

Mass remove/add to multiple security groups cross region

Would it be possible to create a script or use something like terraform to mass remove/add security group entries across several regions under the one account based on the security group name? ...
3
votes
4answers
778 views

Is there a way to lint Terraform?

I'm hoping there is something to pick up when I have misspelled variables and comments to save me some time when I'm checking my code and reduce the potential for any errors. I normally use IntelliJ ...
0
votes
1answer
149 views

Terraform deletes AWS lambda layers instead of keeping the older versions

I am using terraform version 12.26 for AWS deployment. Whenever I try updating a lambda layer, the lambda layer version is incremented, but the older layer is deleted. Even though my current version ...
0
votes
1answer
148 views

Terraform foreach multiple map variables

I need to do the following in Terraform but can't work out how Here is what I have local { app_config = { test-web = { name = "test-web-${local.environment}" ...
1
vote
1answer
311 views

Can you inherit a template_cloudinit_config in another template_cloudinit_config object in Terraform?

I recently discovered template_cloudinit_config within Terraform, and I'm hoping I can utilize it to specify something like the code below. Basically my goal is to declare a core ...
0
votes
1answer
712 views

Terraform Dynamic Block with list intro them

I'm creating a AWS Cloudfront module and some troubles are happening because have some Cloudfront parameters that are "dynamics/optional" too. When I'm trying run the $ terraform validate ...
0
votes
1answer
29 views

Create dynamic resources using 'for_each' or 'for'

I want to create multiple resources using this: resource "group" "list" { g_name = group_name p_name = project_name } The input local variable is nested: > local....
0
votes
1answer
45 views

Provision and configure Azure VM in private subnet (file, remote-exec, cloud-init, etc.)

(Originally posted to discuss.hashicorp.com) I’m setting up a basic multi-tier infrastructure composed of two Azure VMs: Web server (VM1) with public IP and private IP (subnet1) Data server (VM2) in ...
1
vote
2answers
67 views

Populate Database

I am using Terraform Cloud to build the infrastructure. One of the resources is a postgresql database. What is the best way to populate the database by creating tables, multiple schema etc after the ...
3
votes
1answer
187 views

Dedicated/Separate Git Repo as Terraform Remote Backend

I see that there are multiple options for Backends, however git isn’t one of them. I believe git can be used as a backend for tfstate, in the below steps: Create a dedicated git repo Commit the ...
1
vote
1answer
368 views

Terraform: Sanitize a map that may be a map of strings or map of maps or combo of both

I want to take a map such as this that is passed in as a variable cidrs = { A = [1.1.1.1] B = [2.2.2.2, 3.3.3.3] Group1 = { C = [4.4.4.4] D = [5.5.5.5] } } and then within the locals ...
0
votes
3answers
312 views

How can I list all environment variables configured in Terraform?

I configured AWS provider in Terraform by providing an access key and secret as environment variables according to the documentation: $ export AWS_ACCESS_KEY_ID="anaccesskey" $ export ...
0
votes
1answer
78 views

Find relevant domain/hosted zone under which to host subdomain

Context In Terraform, to create a new domain record, I first need to find the zone under which it should be hosted. E.g. If I want to create a DNS record for mysite.example.com, I'd get the zone ...
1
vote
3answers
633 views

How to produce a map from the cartesian product of two lists to use with for_each on a resource with Terraform

I need to create a datadog synthetics monitors with the resource datadog_synthetics_test I need to monitor multiples cluster, with multiple point of view : # Clusters variable "...
1
vote
1answer
262 views

Include verbose output in terraform/terragrunt

Is there any way to include verbose / debugging output in Terraform / Terragrunt? I'm new to the language, and often struggle with knowing exactly what's going on. It would be helpful for me to be ...
2
votes
1answer
103 views

Are manual changes to an aws IAM policy detected by Terraform plan?

I know that Terraform dose some checks before the plan and can detect some changes but not others such as detecting changes to variables on a lambda but not detecting a new secret in a secret manager. ...
1
vote
1answer
300 views

Terraform fails on creating network with libvirt provider

I wanted to spin up a test environment locally using the description from this stackoverflow answer: https://stackoverflow.com/a/58607900/4397899 The main.tf looks like ##############################...
1
vote
3answers
105 views

Run integration test with ansible playbook using terraform provisioning

Ok so I am totally new to devops! I am an experienced developer, but at my new job I have been tasked to automate CI/CD. Non-existing so far. Only CI with Travis. So the ideal workflow is: Push to CI ...
1
vote
1answer
556 views

Troubleshooting VPC flow logs with an S3 bucket using SSE-KMS encryption with CMK

I'm using Terraform and trying to set up automatic export of VPC flow logs into an S3 bucket in the same AWS account and region (ca-central-1) that has default encryption turned on with AWS-KMS (using ...
1
vote
2answers
127 views

How do we move to a modern CICD approach

This may also be a general pulse; but here lies the issue We use EKS, we have Jenkins, we have Ansible, we have Terraform, we have BitBucket; but none of these really form a pipeline and I'm stuck ...
1
vote
0answers
36 views

secret id in docker terraform file

what value secret_id variable is referring in below main.tf and terraform.tfstate code There is no variable called "id" in my secrets.tf file main.tf resource "docker_service" "mysql-service" {...