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.
19,000
questions
0
votes
0
answers
3
views
Databricks Unity Catalog Schema: do not get the Catalog Name
I have a resource such as the following:
resource "databricks_schema" "schema" {
for_each = xxx
catalog_name = each.value.name
name = each.value.schema
}
Now, I ...
1
vote
0
answers
8
views
Is there a way to exclude a folder from a TerraformAsset?
I am following this guide for getting a docker image to run on AWS ECS:
https://github.com/cdktf/docker-on-aws-ecs-with-terraform-cdk-using-typescript/tree/main
In their 'build and push' docker step ...
-1
votes
0
answers
16
views
Terratest on terraform script that is used to build an infrastructure in Azure
I am trying to do testing on my terraform script and I am getting these errors can someone please help me with this, below is the _test.go code
package main
import (
"os"
"testing"...
0
votes
0
answers
19
views
How to add secrets to existing path in vault using terraform
I'm new and would appreciate advice on managing secrets in a terraform with vault. We use a modular code structure.
./project
├──── dev
│ │
│ ├── local.tf
│ ├── main.tf
│ ├── ...
0
votes
0
answers
11
views
Is it possible to use Terraform to set up email alerts for Azure backups?
We've built some Terraform code to do backups for on of our Azure VMs which works fine..but I'm struggling to find resources to help me automate the reporting of the backps..I need an email sending ...
0
votes
0
answers
17
views
malformed policy / self reference
I was trying to provision AWS kms key using terraform, added the code which I am using. In this kms resource I need to add a AWS kinesis firehose role to access the kms key. For that in the code I ...
0
votes
0
answers
28
views
Terraform Azure Resource Destroy
I have a simple terraform code which creates a storage account. When I plan and deploy it from my personal VM, it is fine and remains in sync.
When I then use github actions and automate that process, ...
0
votes
0
answers
17
views
Azure PIM Role Settings for Owner role
Trying to set Azure PIM Role Settings for owner role via terraform includes Azure MFA, Activation hours, and also send notifications when eligible to activate this role via local_exec provider in ...
0
votes
0
answers
21
views
Cannot draw Terrform cycle with colors using `terraform graph` with plan output file
I want to generate a resource graph using terraform graph that includes my cycle coloured. For this purpose, I first generate a plan, as terraform graph without -plan option shows no cycle (why?):
...
0
votes
2
answers
20
views
Scale up and scale down cloudwatch alarms
I have an ECS service that I want to scale up and down depending on how many items are in an SQS queue.
resource "aws_cloudwatch_metric_alarm" "sqs_scale_up" {
alarm_name = "...
0
votes
1
answer
56
views
How can I reuse the terraform output values in another Github action using terraform
Currently we are mapping manually repos details as below, meaning that we are adding every repos details manually for attribute.repository.
workload_identity_pool_attribute_mapping = {
"google....
0
votes
0
answers
11
views
Terraform plugin framework - copy fields from terraform model object type to custom object type
We are building a custom terraform provider using terraform-plugin-framework.
We are trying to copy “Object type” values from terraform model(generated using the plugin framework) to custom model ...
-2
votes
2
answers
37
views
Exclude directory from terraform archive file for lambda function?
I have a lambda function defined via a terraform file. When I terraform apply it, I get an error that the resultant .zip file is larger than the maximum size allowable for a lambda file. Initially ...
0
votes
0
answers
16
views
Cannot make rolling update with kuberenetes nginx controller - temporary (about 0.3s) connect() failed (111: Connection refused) happens
I'm having trouble making nginx rolling update with helm_release.
resource "helm_release" "server" {
name = "server"
chart = "server"
...
1
vote
0
answers
32
views
Issues with Terraform assignment_review_settings block
I am running into a issue where I am trying to set up an assignment policy for Access Package in Microsoft Azure. The code works fine when I remove the assignment_review_settings, but adding it gives ...
0
votes
1
answer
15
views
How to run a one-off ECS task in CodePipeline using Terraform?
I'm trying to set up deployment for a Django web app using Code Build, Code Pipeline and Terraform but I can't figure out how to start a one off task in the pipeline to run the migrations.
I've found ...
0
votes
3
answers
37
views
Terraform variables.tf from one module not visible by other module
I'm trying to implement Sharing Common Variables
Directory structure:
common/
outputs.tf
terraform.tfvars
variables.tf
tut/
main.tf
outputs.tf
main.tf
I want to share common/variables.tf ...
0
votes
0
answers
34
views
Azure VM data disk replication is failing using terraform
I’m trying to replicate azure windows VM, OS disk is replicating properly but unable to replicate the data disk using terraform script, getting same error after trying multiple times
all the values ...
-1
votes
1
answer
52
views
Terraform azure databricks unity catalog from start
I would like to create a single terraform .tf that creates my databricks environment from scratch. I have followed an example that creates an databricks workspace in azure and it works fine.
https://...
-5
votes
0
answers
31
views
Is it possible to create a new terraform module and which will help to ignore the diff with specific tags [closed]
Assume a terraform script, where it has instance and volume created.
After a day or two, from portal we have deleted a volume.
After a week, from terraform I would like to update the tags, instance ...
0
votes
0
answers
40
views
Add service principals to Databricks using terraform
In the past eveytime I was deploying the databricks with terraform I had to add the Azure SPN manually. But now Im learning more and decided to automate this too. Since the new Changes to Azure ...
0
votes
1
answer
28
views
Create terraform variable containing single quote
I need to configure a folder name containing 2 single quotes inside :
/team/a/company/incoming/test/${date('yyyyMMdd')}
While escaping the $ was easy, I can't find a solution to escape single quotes.
...
2
votes
2
answers
39
views
how can I pull data from this structure in terraform?
I have this structure in a terraform output:
"eks_private_subnets_in_zones": {
"value": {
"us-east-1a": [
"subnet-11111111111111111",
"...
0
votes
2
answers
32
views
Terraform required_version refers to .terrafrom-version
My Apologies if this is a repeat question. I have a terraform repo list this:
project/
├── .terraform-version
└── my-terraform-config/
└── main.tf
I would like to configurate "required_version&...
0
votes
1
answer
47
views
How to use output of data resource in other resource using terraform
I am trying to connect to the jfrog artifatory using
provider "artifactory" {
url = "url"
access_token = "token"
}
I amrefering link to read repos from ...
0
votes
0
answers
36
views
ERROR: Unsupported attribute; This object does not have an attribute named "AdminDefaultCachePolicy"
A newbie to terraform but hoping SO community can help with this one ^^
The goal: To create a default cloudfront AWS cache policy
full error;
./tf.sh plan -p sponde/aws/global/t4s-sponde/prod/...
0
votes
0
answers
85
views
The document cannot be deleted since it is referenced by "X"
I am trying to modify Azure Synapse configurations via Terraform.
When I launch my CD pipeline in Azure DevOps I have an error with Terraform :
Error: waiting for the deletion of Spark Pool: (Big Data ...
-1
votes
1
answer
28
views
Is there a way to use terraform on Google Cloud to build VMs with Python and Python libs installed? [closed]
I'd like to create a terraform script to build developer VMs with Python and DB connection libs already installed.
Searches show using sudo apt-get, but that method produces errors. Google searches ...
0
votes
1
answer
26
views
Issue with terraform GCS output
I have written a terraform module which can create multiple cloud storage buckets.Its working fine but it has issue in creating outputs.
main.tf
resource "google_storage_bucket" "...
1
vote
1
answer
33
views
Terraform failing with Invalid for_each argument / the "for_each" argument must be a map, or set of strings
When running terraform plan I get the following error:
The given "for_each" argument value is unsuitable: the "for_each" argument must be a map, or set of strings, and you have ...
0
votes
1
answer
33
views
How to set the Severity as Error in GCP alert page using Terraform GCP
I am setting up for IaC in Terraform for Google cloud function when error occurs.
This is my code in Terraform:
resource "google_monitoring_alert_policy" "my_cf_alert_policy" {
...
-1
votes
0
answers
38
views
Avoid an input from user for changing the value [closed]
I'm currently writing a pipeline for Terraform using a YAML file which will be created via GitHub Actions.
I'm wanting that a user cannot change the value of the default input.
This is the part of the ...
0
votes
1
answer
19
views
Terraform Azurerm azurerm_shared_image_version data not reading latest version of image
I am creating VM using Ubuntu based custom image from Azure Compute Gallery. Following is the data block that I'm using to get latest image version and update the VM.
data "...
0
votes
1
answer
19
views
Grouping By A Value In An Object Generated In For Loop
I figure this is probably covered by another SO post somewhere but I'm struggling to find it so here goes.
Description
I am attempting to build a local set of variables to configure ec2 instances to ...
1
vote
1
answer
28
views
Issue provisioning bucket policy error: api error MalformedPolicy: Invalid policy syntax
this is my terraform code. Im provisioning bucket s3 and a policy to attach it.
resource "aws_s3_bucket_policy" "bucket_policy" {
bucket = aws_s3_bucket.bucket.id
policy = ...
0
votes
1
answer
48
views
Terraform for AKS Application Gateway Ingress Controller 502 and its subnet peering issue
its works fine when:
everything build on azure portal
enable agic in kubernetes service networking
import self signed ssl cert
host table mapping
When deploy by terrform:
deploy a web page, using ...
0
votes
0
answers
34
views
Unable to update aws eks managed nodegroup to latest AMI Version using EKS Blueprints for terraform version 4.32.1
Getting this error when trying to update the eks nodegroup AMI version to a higher version than existing version using eks blueprints for terraform version 4.32.1:
waiting for EKS Node Group (poc-...
-3
votes
0
answers
26
views
How to implement AWS account - Datadog integration with Terraform? [closed]
I came across this recommended way of creating AWS - Datadog integration on Datadog dashboard. I'd like to implement this configuration using the recommended cloudformation stack with terraform. What ...
0
votes
0
answers
35
views
Terraform backend with aliased providers - fail to get workspace
I have an infra in Terraform that manages resources of two accounts: a main one and a child one (sandbox). The goal is to write cross-account policies & roles to allow export of resources from ACM,...
1
vote
0
answers
44
views
Azure Functions App Runtime Worker failing on deployment
I have an Azure Linux Functions App with a single function (for now) with a Blob Trigger. Deployed via Terraform and GitHub actions without error.
function.json
{
"scriptFile": "...
-2
votes
3
answers
39
views
How to solve terraform error for configuring local aws credentials?
I am using below code to for configuring aws creds.
provider "aws" {
region = var.region_name
profile = "default"
}
terraform {
required_providers {
aws = {
...
0
votes
1
answer
35
views
Terraform: filter for Objects with specific Attribute
I have the following list as a local:
person = [
{
name = "bob"
grants = [
{
principals = "[email protected]"
},
{
group = [&...
-1
votes
0
answers
40
views
Terraform AWS, Devide one tfstate file into two tfstate file on s3
I am managing AWS with Terraform. I am managing the tfstate file of one project by storing it in S3,
I'm going to separate the project into Team A/B.
Current Directory Structure
project
ㄴ provider.tf
...
0
votes
1
answer
36
views
Getting NameResolutionError: Failed to resolve 'oauth2.googleapis.com' trying to upload file to Google Cloud Storage via app on local k8s cluster
I have Kubernetes deployment with the following config
resource "kubernetes_deployment" "batch-producer" {
metadata {
name = var.app-name
namespace = var.k8s-namespace....
0
votes
0
answers
29
views
Edit CodePipeline that applies terraform code
We have all AWS resources managed in a CodeCommit repository with terraform. This includes the CodePipeline that performs an actual deployment of changed terraform code. Is it possible to safely ...
-1
votes
0
answers
17
views
Terraform Api Gateway Lambda unable to create multiple Integrations
I Am trying to create aws_api_gateway_integration for both both proxy and root. How ever proxy is overwriting the other in Lambda triggers.
code for proxy
resource "aws_api_gateway_method" &...
-2
votes
0
answers
13
views
Terraform adding try function inside a heredoc string
I have a Terraform code deploying a CFN template. Within this template I want to use a terraform try function. Is there a way of using functions inside heredoc strings?
0
votes
1
answer
29
views
Value of a module reference in Terraform
I'm trying to get my api gateway deployment to redeploy when I'm making changes to it's endpoints. Each of those endpoints is defined within a module and so by following this documentation, I end up ...
0
votes
1
answer
21
views
Azure apim named value for backend setup
I have an APIM named value that points to a secret in Key Vault.
I'm seeking a solution to utilize this 'named value' as a header value when defining the APIM backend.Here is a snippet of the code in ...
-2
votes
1
answer
68
views
terraform data block for amazon linux 2023
We are managing all our ec2 resources using terraform which is running in amazon linux 2, i am trying to migrate the linux version to Amazon linux 2023 using in terraform.
Currently we are providing ...