Questions tagged [terraform]

A tool from Hashicorp is used for defining infrastructure as code. On-topic questions are concerned with the use of the tool itself or how to use the 'code' (HCL) to define specific structures. This tag is often used with public-cloud tags, such as "amazon-web-services", "google-cloud-platform", or "azure", to explain further the question being asked.

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

how to add subnet ids dynamically to an azure keyvault network rules

I need help to add all the subnet ids to the network acls list. I have kept only the needed code below to keep the question simple. variable "subnet_names" { type = list(string) default = [...
Dilly B's user avatar
  • 1,310
-1 votes
1 answer
13 views

Creating ASG using Terraform on AWS having Nginx installed [closed]

Create an Autoscaling group using Terraform on AWS. The instances in the group should have Nginx installed on them. Parameters in the ASG can be set at your discretion and should be mentioned in the ...
Jagdev Singh Dosanjh's user avatar
0 votes
0 answers
14 views

Terraform plugin -- mark resource for update

I'm writing a terraform provider using the terraform plugin framework (not SDKv2). I have a resource that is loading and merging data from different files, which then can be used by other resources, e....
VHristov's user avatar
  • 1,059
-2 votes
1 answer
19 views

Creating a Terraform Provider: Handling Updates with Deletion and Creation

I want to create a terraform provider. I'm implementing a resource that doesn't offer an update API route, so the update must result as a delete and a create. I'm using terraform-plugin-framework, and ...
Thomas Saison's user avatar
0 votes
1 answer
25 views

Reference to resources ID inside variables Terraform without using modules

How to reference resources ID inside variables Terraform without using modules. I'm trying to create a full stack from VPC AND Ec2. every resources in individual files named EC2.tf and vpc.tf I want ...
Reham Adel's user avatar
0 votes
0 answers
14 views

applying two rules in S3 bucket lifecycle policy for subfolders using terraform code

I have s3 bucket "my-bucket" which contains multiple objects and folders. this bucket also contains the "TestDataQA" folder. I want policy which will delete object from "my-...
Rohini's user avatar
  • 7
0 votes
1 answer
26 views

Fixing JAR File Reference in AWS CodePipeline for Lambda Deployment

I am working on an AWS CodePipeline project where I want to build and deploy a Java Lambda function whenever there are changes to my source code repository. I have created Terraform configuration to ...
Basim's user avatar
  • 85
0 votes
0 answers
14 views

Using the Terraform Docker Provider with a DigitalOcean droplet resource

I am using Terraform to create Digital Ocean droplets, and I would like to use the Docker provider to set up my app after the droplet is created, however, I can't configure the Docker provider to use ...
Alex Escalante's user avatar
-1 votes
1 answer
12 views

Terraform Error: creating CloudWatch Alarm ValidationError - Invalid metrics list status code 400

I'm attempting to create a CloudWatch anomaly detector alarm for my Kinesis data stream using Terraform. I made the following setup based on the official Terraform xx_anomaly_detection example in ...
mmarion's user avatar
  • 837
0 votes
1 answer
24 views

Terraform state keeps changing - security rules being added with OKE [closed]

I am currently using Terraform to manage my OKE cluster. I have a public subnet (CIDR 16.0.0.0/24) which the control plane (OKE) has a public IP on. I have a private subnet (CIDR 16.0.1.0/24) as ...
Niv's user avatar
  • 523
-1 votes
0 answers
22 views

Better Comments extension with VsCode (WSL, Terraform) [closed]

I am trying to use Better Comment extension for terraform files within Vscode in WSL. But this extension isn't working only for terraform files. rest works. https://marketplace.visualstudio.com/items?...
csr1985's user avatar
  • 29
0 votes
0 answers
24 views

GKE resources recreated on every `terraform apply` without any configuration changes

I'm encountering a behavior with the Google Cloud Terraform provider where GKE resources are being recreated every time I run terraform apply, even though there are no configuration changes. I've ...
dkargatzis's user avatar
0 votes
1 answer
35 views

Invalid AWS Region: il-central-1 error while deploying EKS using Terraform

I am trying to deploy EKS Cluster using terraform. Currently I am using source as "hashicorp/aws" and version: 5.16.0, I am trying to deploy in "il-central-1" region. I am getting ...
Zoro's user avatar
  • 127
0 votes
0 answers
10 views

How can I ensure fitting user right for .qcow2 file in my terraform implementation

I have debian based kvm/qemu installation and want to deploy a virtual machine via terraform. provider "libvirt" { uri = "qemu:///system" # Verbindung zur lokalen QEMU-Instanz } ...
HochWieBreit's user avatar
0 votes
0 answers
10 views

Is it possible to export state of whole environment in terraform? [closed]

Can we Export backup tfstate of the whole environment not infrastructure? i think exporting whole environment state is not possible... exporting infrastructure state is possible i visted some sites ...
Sowjanya Panchakarala's user avatar
0 votes
1 answer
53 views

Implement Router/NAT Gateway in Azure

I have to configure a router that allows giving Internet access to the instance on the private network, this instance will run a simple Apache Server with a test page, the following steps must be ...
Gabriel Fallas's user avatar
0 votes
0 answers
34 views

Plan only on changed parent modules in terraform

Given: Let's say there are some modules and some parent tf files that call their corresponding modules. For example: . ├── modules │   ├── module_1 │   ├── module_2 │   └── module_3 └── parent_modules ...
Andromeda's user avatar
  • 1,278
1 vote
1 answer
27 views

How to (elegantly) create a dynamic map inside a variable?

I have a list(string) as a declared variable, and need to create a map out of it inside a module variable. The context is the AWS eks module, which contains an input named eks_managed_node_groups of ...
Dirk Jablonski's user avatar
1 vote
1 answer
32 views

Terraform: Issues creating aws_lb with aws_subnets

I am working through some Terraform code designed to deploy a VPC, create public and private subnets, and then create load balancers, ECS containers, etc. My VPC creation works fine, but I'm running ...
Shadowman's user avatar
  • 11.2k
0 votes
1 answer
24 views

Data Block in Terraform Referencing the not created State File in the first run

I have a little unique situation while running Terraform. Code is creating resources in Azure. But, we ought to have an order of when which resource would be created. For example - Keys, Identities, ...
Shubham Shekhar's user avatar
-1 votes
0 answers
45 views

how to loop over a terraform module?

I have the following terraform module: locals { vm_ips = { "abc" = 1 "def" = 2 } } variable "vm_ips" { type = map(list(string)) default = local.vm_ips ...
Ajinkya's user avatar
  • 1,803
-1 votes
1 answer
45 views

Error while provising an (AKS) cluster node pool using Terraform [closed]

I am getting the following error when providing an Azure Kubernetes Service (AKS) cluster node pool using Terraform: Error: azurerm_kubernetes_cluster_node_pool.example: The Kubernetes/Orchestrator ...
Venki's user avatar
  • 227
-1 votes
0 answers
17 views

Terragrunt apply fails (could not find aws credentails )

We use Terraform and Terragrunt to manage AWS infrastructure. when I run the terragrunt locally it seems fine and no issues in deploying infrastructure but it errors out while deploying through ...
skkc's user avatar
  • 11
0 votes
1 answer
20 views

Unable to make all Elastic IPs working together

I have an AWS EC2 instance(Amazon Linux - t2.small) created by Terraform with Nginx installed assigned with 3 Elastic IPs, each of them is attached to an Network Interface that have Security Group ...
Thanh Luu Cong's user avatar
0 votes
0 answers
37 views

Backend Health Unhealthy in Azure. Connectivity Test failed

I have created a application gateway in Azure. I have redirected all the traffic from application gateway onto a domain name using private DNS. The application gateway got created successfully. But, I ...
Lekha's user avatar
  • 35
-1 votes
1 answer
32 views

How to prevent leak from my provider access_key while using Terraform

I did not found any great documentation on the way to avoid setting the backend configuration or the access_key of Terraform out of the source code. Is this the best way ? : Hashicorp Terraform Remote ...
Weac's user avatar
  • 124
1 vote
1 answer
48 views

HTTP 401 Azure Terraform Action Group sending log search alert to Azure Function

I have a weird problem: I have an action group in Azure that is deployed via this terraform code: resource "azurerm_monitor_action_group" "example" { name = "...
Odelys's user avatar
  • 11
-1 votes
0 answers
25 views

Create subnet based on defined structure in loop

I have prepared a structure like the one below, which can include different subnets and configurations. I am attempting to create subnets based on this structure, but I keep encountering errors. how ...
Korman's user avatar
  • 7
0 votes
1 answer
48 views

"update in-place" runs indefinitely in Terraform

I would like to apply "Azure Services" if there is no value through the conditional statement below, and "var.network_rules_bypass" if there is a value. By the way, Terraform keeps ...
gotothesky's user avatar
0 votes
0 answers
27 views

Terraform AWS Provider Error: The security token included in the request is invalid

I have been using Terraform to deploy one pipeline on AWS successfully for the past few years. However, recently, my colleague and I have encountered an issue when running terraform plan. We are ...
NKLSNKLS's user avatar
0 votes
1 answer
29 views

A data resource "aws_subnets" "selected" has not been declared in the root │ module

I am using terragrunt. I have following declared in data.tf: data "aws_vpcs" "this" { tags = { terraform = "true" project_name = var.project_name } } data ...
Marko's user avatar
  • 1,545
0 votes
0 answers
25 views

Create NLB with 3 targets in cyclic order

I have a requirement where i have 9 EC2 instances and want to create 9 NLBs with each NLB having 3 EC2 instances in them in a cyclic order. Example: NLB 1: Targets 1,9,8 NLB 2: Targets 2,1,9 NLB 3: ...
V S's user avatar
  • 1
0 votes
1 answer
51 views

Problem mounting Azure Storage file share on Azure Container Instance group

When I try to deploy Azure Container Instance with a volume mounted from Azure storage account file share, the terraform apply operation continues saying creating, and finally fails with an error ...
Semere T.'s user avatar
-1 votes
0 answers
15 views

Terraform: Help understanding reading a value from random provide with a r keepers resource

The Terraform docs for random have this example: resource "random_id" "server" { keepers = { # Generate a new id each time we switch to a new AMI id ami_id = var.ami_id ...
Zaphod's user avatar
  • 239
0 votes
1 answer
12 views

terraform, aws_sns_topic_policy use here doc for policy and interpolate variable inside heredoc

I wanted to update my sns target policy using terraform, below is my code. But my terraform plan is failing with below error. Expected the start of an expression, but found an invalid expression token....
iamsage's user avatar
  • 35
1 vote
1 answer
35 views

Git username is inconsistent with gitlab -error

When I am trying to perform git push in my remote branch I am getting the following error. Your git username is inconsistent with gitlab account name. I have tried with the git config commands and ...
user2120's user avatar
1 vote
0 answers
13 views

Getting 'Forbidden: unknown' Error When Bootstrapping Flux with GitLab and Terraform

I am trying to bootstrap Flux with GitLab through Terraform, when I test it, I get this error message and I don't understand what I am doing wrong. │ Error: Bootstrap run error │ │ with ...
stubbe's user avatar
  • 11
0 votes
0 answers
19 views

Why am I getting an Invalid dataSetArn message when trying to build an AWS Quicksight project using Terraform?

I am trying to deploy an AWS Quicksight project using Terraform. Here is my Terraform config: resource "aws_s3_bucket" "sample_data" { bucket = "testing-quicksight-dataset&...
vile_goat's user avatar
-1 votes
0 answers
30 views

terraform. DeleteConflict: Cannot delete a policy attached to entities

when I am creating it's not having any issues. But while it tries to destroy the policy it throwing me the errors. So how can I fix this ... is there anything like force_destroy like s3? When I go to ...
change198's user avatar
  • 1,665
0 votes
1 answer
30 views

How can I set up AWS CLI using Terraform

The idea is to create a scheduled task to run once per while and scan all S3 buckets to retrieve the list of objects with their size. I wrote a bash script, which works fine. However, I am thinking of ...
KrystianJuniordevops's user avatar
0 votes
2 answers
35 views

for_each on a resource with count on other resource

I am trying to do this : Add or not repo if set or not : resource "google_cloudbuildv2_repository" "repo" { count = var.repo != "" ? 1 : 0 } do a for_each ...
user3218488's user avatar
0 votes
2 answers
64 views

Error when creating Azure Storage Account with Terraform. "Blocks of type dynamic are not expected here"

I wrote it as follows by referring to this link. https://github.com/claranet/terraform-azurerm-storage-account/blob/master/r-storage-account.tf Blocks of type "dynamic" are not expected ...
gotothesky's user avatar
0 votes
0 answers
10 views

Create a Key and save the .pem file using Terraform (Windows/AWS)

I am trying to create a EC2 server and after this server is created, run a few lines of code to install Nginx. For this, I need to create first the key pair, save it in a .pem file and then access the ...
Rga91's user avatar
  • 1
-1 votes
0 answers
21 views

Cloud function trigger twice with GS from SFTP gateway GCP

A have an export of data from the API to sftp which will store the data in GS, when it's in bucket I have cloud function the extract data and send it to bigquery. I have event_type = "google....
Hamza ajeddig's user avatar
0 votes
0 answers
31 views

Lambda Role not authorized to perform emr-containers:CreateVirtualCluster

Hello I am using lambda in terraform to deploy a cloudformation stack to create an EMR virtual cluster in our Kubernetes cluster. I am doing this as a workaround for having a terraform version lower ...
shxpark's user avatar
  • 297
-2 votes
0 answers
24 views

How to validate terraform plan using OPA policies in azure devops pipeline [closed]

I'm new to OPA, looking to implement terraform plan validation before performing terraform apply using OPA policies in Azure devops pipeline. I have gone throught this article from Microsoft, and it ...
Madhu's user avatar
  • 411
0 votes
2 answers
26 views

How to import existing ECR repository into Terraform

I've tried variations of the following tf file after reading these docs: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecr_repository to import an existing ECR repository....
Kevin's user avatar
  • 1,102
-1 votes
0 answers
25 views

GCP Data IAM Policy terraform format , nested dynamic block

I am struggling with this Terraform / GCP google_iam_policy datablock, to be inputted into a google_project_iam_policy resource. Say I have a local value that outputs as such: all_roles = [ {...
Cole Gulledge's user avatar
1 vote
1 answer
27 views

Validate that a Terraform variable is a list of alphanumeric strings

I am trying to validate a variable in Terraform contains a list of alphanumeric strings. For this I'm using a regex and validating each element in the list matches this regex. variable "...
Geert Smelt's user avatar
  • 1,001
0 votes
0 answers
13 views

Setting resource annotations via OLM

Problem I am trying to use terraform to deploy a cluster with a predefined set of applications/resources. I want to deploy operators to manage my resources, but I am running into an issue when ...
aRustyDev's user avatar
  • 111

1
2 3 4 5
365