Failed to save state open terraform tfstate permission denied

0 votes

I am new to this technology. I have been trying to create AWS EC2 instances using Terraform.

$ terraform apply

I got the following output after executing the above command.

aws_instance.example: Creating...
  ami:                         "" => "ami-2d39803a"
  associate_public_ip_address: "" => "<computed>"
  availability_zone:           "" => "<computed>"
  ebs_block_device.#:          "" => "<computed>"
  ephemeral_block_device.#:    "" => "<computed>"
  instance_state:              "" => "<computed>"
  instance_type:               "" => "t2.micro"
  key_name:                    "" => "<computed>"
  network_interface_id:        "" => "<computed>"
  placement_group:             "" => "<computed>"
  private_dns:                 "" => "<computed>"
  private_ip:                  "" => "<computed>"
  public_dns:                  "" => "<computed>"
  public_ip:                   "" => "<computed>"
  root_block_device.#:         "" => "<computed>"
  security_groups.#:           "" => "<computed>"
  source_dest_check:           "" => "true"
  subnet_id:                   "" => "<computed>"
  tenancy:                     "" => "<computed>"
  vpc_security_group_ids.#:    "" => "<computed>"
aws_instance.example: Still creating... (10s elapsed)
aws_instance.example: Still creating... (20s elapsed)
aws_instance.example: Still creating... (30s elapsed)
aws_instance.example: Creation complete
Failed to save state: open terraform.tfstate: permission denied

Although, the EC2 instance gets created, but the state of my infrastructure is not saved as you can note in the last line in the console output.

Can anyone help me with this?

Thanks

Jul 10, 2018 in DevOps on Cloud by shubham
• 7,340 points
1,335 views

1 answer to this question.

0 votes
Here is what you can do. Just check the permissions of the directory in which terraform have been placed.

Just do the changes according to your requirements in permission mode of home directory and terraform will work fine.

I hope the above information will be helpful to you.
answered Jul 10, 2018 by shubham
• 7,340 points

Related Questions In DevOps on Cloud

0 votes
1 answer

Unable to save state: open terraform.tfstate: permission denied

Check the access permission of the directory ...READ MORE

answered Jul 13, 2018 in DevOps on Cloud by Atul
• 10,240 points
1,651 views
0 votes
1 answer

Is it possible to open a bug in VSTS if release deployment fails?

You can do this by adding another ...READ MORE

answered Apr 24, 2018 in DevOps on Cloud by DareDev
• 6,890 points
483 views
0 votes
1 answer
0 votes
1 answer

I am looking for a python code to get my Azure VM status in my email , like whether the running vms port is open to the internet. If its open to internet I should get a mail notification

Hey, @Sourav, Check this out https://www.edureka.co/community/66025/azure-vm-monitoring It deals with ...READ MORE

answered May 29, 2020 in DevOps on Cloud by Sirajul
• 59,230 points
1,444 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,503 views
+2 votes
1 answer
+2 votes
3 answers

How do I deploy Scala PlayFramework Project to IBM Bluemix

It seems that they are more than ...READ MORE

answered Oct 18, 2018 in DevOps on Cloud by lina
• 8,220 points
885 views
0 votes
1 answer

How to manage Application version for VM&#39;s in Azure Autoscaling group

First of all, You have to launch ...READ MORE

answered Apr 24, 2018 in DevOps on Cloud by shubham
• 7,340 points
773 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP