Questions tagged [terraform-state]

23 questions
31
votes
2 answers

terraform statefile is locked how do I unlock it

I am trying to use basic terraform commands like plan, but cannot because the terraform state is locked (see below.) I know I am the only person or process interacting with this terraform instance, and see my name in the Who line of the lock below. …
Amit Sharma
  • 321
  • 1
  • 3
  • 4
2
votes
1 answer

Distributed team working with terraform shared state and distributed git repository

I'm having trouble to know how to properly work with Terraform in a distributed team. My team is using using git to work with terraform "*tf" files, using shared AWS accounts. We keep a shared distributed Terraform state in an AWS S3 bucket and each…
earizon
  • 2,099
  • 19
  • 29
2
votes
1 answer

Is it possible to access all resources in a terraform remote state that aren't declared as outputs

I am trying to get some references from terraform remote state, and have noticed some differences between terraform state resources / data, and using a terraform_remote_state data object. For example, I have a terraform module that created an AWS…
Brett
  • 5,690
  • 6
  • 36
  • 63
1
vote
0 answers

Terraform - azurerm_frontdoor_custom_https_configuration - 'the given key does not identify an element in this collection value'

this code has worked before, all I'm trying to do is add new frontend endpoints, routing rules, backend pools I've tried only sharing the code snippets that I think are relevant but let me know if there's some key info you need missing This one…
1
vote
0 answers

How to downgrade Terraform major version in state file?

I'm using Terraform and accidentally changed the version in the state file from v0.11.14 to v1.0.10 while playing around with upgrading Terraform. Initializing the backend... Error: Terraform doesn't allow running any operations against a…
Marc Robberts
  • 19
  • 1
  • 3
0
votes
1 answer

Separate GCS terraform backends to deploy multiple resources in respective projects

I have three GCP projects let's say project-01, project-02 and project-03 and I'm trying to create Compute Instance in those respective projects using single terraform module. Below is the terraform.tfvars file compute_instances = { …
0
votes
1 answer

In Terraform, how do I apply DiffSuppressFunc on a TypeList with each element in the list being an object following a schema?

Brief Context I am working on coding a Terraform Provider (using the Terraform SDK), which has a resource. The schema of the resource has a couple of attributes, of which one is "sample_attribute": { Type: …
0
votes
0 answers

How to display contents of my terraform S3 state file in Ansible?

I am new to Ansible; couldn't find this on the docs. I know that I can run terraform plan and apply based on the check_mode boolean. But I need to run terraform state list and terraform show and possibly terraform state show {resource} based on my…
Devang Sanghani
  • 731
  • 5
  • 14
0
votes
1 answer

What could be causing missing app setting attributes in terraform state file after successful terraform import and apply?

Azure terraform import does not import all attributes in terraform state file after terraform provider version upgrade from 2.x to 3.x I upgraded deprecated resource 'azurerm_function_app' to 'azurerm_linux_web_app' and…
0
votes
0 answers

terraform destroy throws error, after updating the terraform state file using terraform state rm

I am facing an error to execute the command terraform destroy after terraform state rm resourcesName. I wanted to skip the deletion of a few resources which are present in terraform state file, so I removed the entry of resources from the state…
Inder malviya
  • 149
  • 1
  • 12
0
votes
0 answers

Importing manual changes to terraform state

I was trying to change the EC2 type using Terraform but the Terraform plan just wouldn't recognise the EC2 SKU change, so I went ahead and manually changed the size via the Amazon console. I am using a remote state file, now I would like to sync the…
0
votes
1 answer

Store terraform state remotely

I'm using terraform to ensure a consistent configuration for my github repos using the Terraform Github Provider. Basically this works fine. But now I experience some undesired behavior with my terraform state. I develop from my local workstation…
0
votes
1 answer

2 terraform state files in two different S3 buckets, same code, possible?

Folks! Need some help here. Problem statement - We have a project in which we create AWS infra from TF code. We trigger it through Azure DevOps pipelines, infra gets created, and the state file gets stored in an S3 bucket. This is perfect. Now, we…
Ravish Rawat
  • 476
  • 2
  • 15
  • 48
0
votes
1 answer

How to terraform output from state file with or without jq?

I need to read some data from the state file, to be specific, I need to import a DNS record's IP address into my terraform configuration. I have a resource aws_route53_record.dns_record that I imported from the state file. This is the output…
0
votes
0 answers

Iterate over multiple state file to get a list of strings in terraform

I am new bee and have an issue while retrieving the value from state file. At present what I want is to retrieve the value of vpc_id from multiple state file and create a list of strings out of it so that it can be passed to a…
user3616775
  • 75
  • 1
  • 10
1
2