Questions tagged [terraform]

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

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

How to create dependency between modules in terraform

I have 2 modules A and B. I want a particular resource in module B to be created only after a particular resource in module A is completed completely. I was trying to achieve just that with this as ...
0
votes
1answer
19 views

Calling a Terraform object in seperate folder

I need to reference my VNET Gateway residing in an infrastructure folder, in a VPN folder in order to connect a VPN utilising a Local Network Gateway, but these could be any object in Azure for the ...
3
votes
2answers
68 views

What is the most used tool for Cloud Infrastructure deployment Ansible vs Puppet vs Terraform?

I have some time for research at work right now, and I was thinking on expanding my knowledge on my favorite subject, which is DevOps (love you all). I have some advanced experience with Ansible, as ...
1
vote
0answers
12 views

How to connect AWS LoadBalancer to EKS node group using Terraform?

I've created the following service using Terraform: resource "kubernetes_service" "example" { metadata { name = "example" labels = { app = "example" } } spec { port { ...
0
votes
0answers
13 views

Importing non-default workspaces in Terraform

I'm having a bit of trouble with Terraform. I have a Terraform project which is shared by a few developers and uses non-default workspaces (i.e. named workspaces, not the default one). I would like ...
0
votes
1answer
25 views

Why does my Terraform config require variables in multiple places?

My folder hierarchy looks like this: / -> live/ : main.tf : variables.tf -> modules/ -> logs/ : logs.tf : variables.tf In my main.tf I have: module "logs" { ...
0
votes
2answers
31 views

How can I find out when Terraform will support newly released AWS services?

For example, AWS announced their new "RDS Proxy" service at re:Invent 2019 and it is now in preview. How can I find out when/if Terraform will support this (for planning purposes)? https://aws.amazon....
0
votes
0answers
14 views

How to handle oauth2 in dynamic environments?

We have a DevOps pipeline supporting 2 services with dynamic environments, where we use Terraform to provision each service independently through a parametrization based on the git's ref that it is ...
1
vote
2answers
39 views

How to create databases, users and grants with terraform mysql and output the created credentials?

For a new deployment I want to create databases, users and grants on a previous created MySQL database on azure. The following code used inside a module creates the environment as expected and I ...
1
vote
1answer
18 views

Having some trouble getting service running with Docker and Terraform

I'm very new to DevOps but I'm trying to learn some of it a bit. I'm working with Terraform, trying to get a service to run on AWS using Fargate and Docker. I've successfully set up my ECR ...
1
vote
1answer
40 views

How to set Terraform Cloud environment variables from the command line?

Terraform Cloud is a SaaS platform for managing Terraform runs, state and variables. Once you have created a project you can set environment variables via the following page: https://app.terraform....
0
votes
1answer
20 views

Unable to understand the logic behind this terraform function

So i was going through a code of some one else and just could not make sense of it,, if may be some can of this, "${replace(jsonencode(list(local.cadvisor_container_definition)), "/\"(\\d{2,5}|true|...
0
votes
1answer
44 views

Use Terraform to manage ssh-keys in GCE

I use Terrafrom and manage access to VMs in GCE by changing VM metadata. Before I put it to string, but it not good, so I try to put them to variable and use it. But I faced problem. This is my code: ...
1
vote
2answers
24 views

how long does it take to deploy a serverless function?

using any method - cli, serverless.com, terraform, roughly: how much time can i expect to pass between these two steps: submitting a new function to AWS (or azure or GCF), and having that function ...
0
votes
1answer
38 views

Where do I use Ansible and where is Terraform used? ( Strengths & Weaknesses) [closed]

What is Ansible mainly used for? Where do I use Terraform? This question focusses on where the tools have relative strengths or weaknesses. For example: Ansible for VM build and Software ...
1
vote
1answer
74 views

How do I enter a multi line variable in Terraform?

It's for the public key variable for testing lab enviroments in my variables.tf file I tried <<EOF the string EOF but terraform dosn't seem to like that
1
vote
1answer
63 views

Terraform creating single SG but multiple CIDR blocks

I am trying to use Terraform to create a single security group that will allow traffic for mongo on port 27017 from all my private subnets that are stored in a variable. My issue is I am unsure how ...
1
vote
2answers
82 views

Given a blank slate, tool recommendations? [closed]

so I have 8 months of DevOps experience previously working as a desktop engineer for two and a half years.Starting a new role in the education sector, recently they brought their IT department which ...
2
votes
1answer
71 views

How to specify specific subnet in Terraform when using for each

I am trying to create an ec2 instance that will hold my Jenkins server. I want this to be in a private subnet which I created using a for each loop. Below is my subnet for each loop and my ec2 ...
1
vote
1answer
79 views

Module directory modules/queues.tf does not exist or cannot be read

I am trying to setup terraform with modules and when doing terraform init after creating a module I have ran into an issue where I am told it does not exist or can't be read. I've checked many times ...
0
votes
0answers
10 views

How to grant the currently authenticated AzureAD Service Principal to a newly created Azure Key Vault?

When creating an Azure KeyVault instance in a subscription, we want to create an azurerm_key_vault_access_policy that grants the Service Principal that Terraform is authenticating as Set and Delete ...
1
vote
1answer
28 views

How can I enable active tracing by default for an AWS Lambda function using Terraform?

On the console, there’s the option to enable active tracking for X-ray tracking but I can see this in the Terraform aws_lambda_function resource the aws_xray_sampling_rule resources? I'm currently ...
0
votes
0answers
62 views

Issue running terraform plan using Azure provider

I have the following terraform statement (see below), howeve I am unable to run terraform plan. Is this an account issue or a code issue? # Configure the Microsoft Azure Provider. #provider "azurerm" ...
3
votes
1answer
19 views

Provisioning a server on behalf of a user on GCP/AWS/Azure and probably relinquish access

I'd like to build a service where I run a custom setup script on behalf of a user on an t2.micro equivalent instance but be able to probably relinquish access to the server. Any advice on the tech ...
1
vote
1answer
51 views

How do I create multiple versions of a lambda function in terraform

I have it creating one version. It has latest and version 2 but can’t getting it to create more than one version of the same lambda? resource "aws_lambda_function" "lambda" { function_name = "test-...
5
votes
0answers
43 views

How Can I create layers for a lambda using Terraform? [closed]

The docs only seem to give me the option to reference existing layers. I want to make the layer for my lambda in my terraform code rather than through the console but can't see any option to do this ...
0
votes
1answer
26 views

Can Terraform pull down the newest state file by itself?

We started using Terraform to create VMs in some Cloud Providers. But we are a team with several people. Terraform has a state file. Whenever someone changes something via Terraform, ex.: ...
1
vote
1answer
25 views

can't access my instances by public IP in a VPC (aka: what is wrong with my terraform)?

As stated in the title of the question, I have a Terraform file (attached below), but the infrastructure it builds doesn't allow me to connect by SSH (I get "Connection timed out"). So either the ...
1
vote
1answer
87 views

How do I use only an encrypted version of my AWS RDS password in my terraform code?

Is there a way to only have an encrypted version of my RDS password in my Terraform code and for AWS to decrypt it for RDS so you use the decrypted password to login to the RDS? So set my rds ...
0
votes
0answers
82 views

Terraform generates different plan for different subscription on Azure

Terraform 0.12.8|Azure Provider 1.33.1|Linux I have a network module as shown below- main.tf: resource "azurerm_virtual_network" "vnet" { name = "${var.vnet_name}" location ...
0
votes
1answer
342 views

Terraform | Error “transport is closing” when “terraform apply” after upgrading to 0.12

Terraform v0.12.7 + provider.aws v2.25.0 + provider.null v2.1.2 + provider.template v2.1.2 Hello, when I try run terraform apply after upgrading to 0.12 I get error: module.elasticsearch.module.ec2....
0
votes
1answer
146 views

Create multiple S3 buckets at once

I am trying to create a static website using S3 buckets. I want to create a bucket for www and non-www versions. I can't work out how to create two buckets at once. I read that you can chain two ...
0
votes
1answer
363 views

Terraform | After upgrading to 0.12 receive a lots of error “unsupported value for ”%s“ at 0: string required.”

After upgrading to 0.12 I receive a lots of error like: Error: Error in function call on main.tf line 136, in data "template_file" "inventory": 136: formatlist( 137: 138: 139: 140: |...
0
votes
1answer
405 views

Terraform | Upgrade to 0.12 error Reference to “count” in non-counted context

I'm trying to upgrade terraform from 0.11 to 0.12 but receiving error: Error: Reference to "count" in non-counted context on main.tf line 33, in data "aws_subnet" "public": 33: id = data....
0
votes
1answer
31 views

How to probe all running aws ec2 instances and their sec groups, etc to generate templates?

Typically I spin up all aws ec2 instances together with all its accompanying security groups, volumes, etc ... by executing a series of aws cli commands. However when I manually use the aws console ...
1
vote
0answers
103 views

Terraform destroys and creates new AWS resources [closed]

Terraform destroys and creates new AWS resources when I modify the modules with new resources. I tried with: lifecycle { prevent_destroy = true } Getting the below error : the plan would ...
1
vote
2answers
37 views

Which Users Should I Create With Terraform And Which With Ansible?

I am creating some Ubuntu VMs in Azure with Terraform. I am then configuring the VMs with ansible. When terraform creates the VM it creates an admin user resource "azurerm_virtual_machine" "main" { ...
0
votes
1answer
364 views

Service account permissions error when provisioning instance group from template

I'm trying to create a GCE Instance Group Manager using terraform resource "google_compute_region_instance_group_manager" "frontend_group_manager" { name = "frontend-igm" base_instance_name = "...
1
vote
1answer
321 views

How to forcibly remove the resource created by the broken module?

I've created few dns_cname_record resources, however Terraform DNS provider started to throw the errors like: Error: update server is not set I've created the bug report for it, as it prevents me ...
1
vote
1answer
2k views

Terraform | The “count” object can be used only in “resource” and “data” blocks,

I'm trying to upgrade out Terraform seeing as 0.12 (stable) came out recently. I've ran into some issues with a certain pair of resource blocks. I'm getting the below error message when trying to do ...
0
votes
1answer
108 views

Terraform: Route53, LB and CDN interdependencies

My team uses Terraform to deploy the necessary infrastructure. Currently, our stack is composed of: AutoScalingGroup fronted by a Load-Balancer, and a Route53 DNS record that points to this LB; We ...
2
votes
0answers
19 views

How to manage the database in an environment per branch, creating a new instance per branch is the best approach? [duplicate]

I'm trying to create an environment per branch using Git lab CI, until here we're good. But my concern right now is how to manage the Database? I thought of using RDS and terraform, but what I'm ...
0
votes
1answer
116 views

GCE metadata not defined on Travis CI

I have tried initializing terraform code in Travis CI but an error keeps coming up; Failed to load state: Failed to open state file at gs://{{project_id}}/terraform/state/default.tfstate: Get ...
1
vote
1answer
50 views

How to override default aws region credentials for Terraform?

I am using Terraform to create aws resources. I practiced with a single region and with my aws cli credentials being used. worked great! however when I tried to override the region in the Terraform ....
-2
votes
1answer
361 views

Terraform aws_ecr_repository resource always attempts to destroy

I have been banging my head against this seemingly simple issue for awhile now. I have some Terraform code which sets up an ECR repository, policy and lifecycle policy. provider "aws" { region = "...
0
votes
1answer
53 views

DevOps Newbie - How to automate windows infrastructure deployment?

DevOps newbie here, so bear with me. I have a project where infrastructure deployment and application deployment is done using powershell and it is tied to VMWare vCenter. For every client deployment,...
4
votes
2answers
1k views

Automate Helm's tiller installation with Terraform

I need to be able to generate disposable kubernetes environments using terraform. These environments should use helm for application deployment and ideally have tiller installed during the terraform ...
2
votes
3answers
2k views

Terraform - referencing existing security group

Is there a way I can associate existing security group to RDS that is going to be created or the only way is to recreate the security group so it can be added to the state file?
0
votes
1answer
100 views

Terraform: Provide credentials for docker hub registry

How would I provide docker hub credentials to a private image in the following example? data "docker_registry_image" "ubuntu" { name = "ubuntu:latest" } resource "docker_image" "ubuntu" { name ...
2
votes
1answer
2k views

Installing Helm charts using Terraform

I have been trying to install Helm charts using Terraform in a cluster which operates in GKE. My question is in two parts: Is it a good practice to use Terraform for installing Helm charts? I have ...