【问题标题】:Failed to save state: open terraform.tfstate: permission denied无法保存状态:打开 terraform.tfstate:权限被拒绝
【发布时间】:2017-03-25 03:45:02
【问题描述】:

我正在尝试使用 Terraform 创建 AWS EC2 实例。

$ terraform apply

执行上述命令后得到以下输出。

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

虽然创建了 EC2 实例,但我的基础设施状态并未保存,您可以在控制台输出的最后一行中看到。

【问题讨论】:

    标签: amazon-ec2 devops terraform


    【解决方案1】:

    在拼命寻找解决方案后,我碰巧检查了放置我的 terraform 文件的目录的访问权限。

    主目录的权限设置为只读。我进行了适当的更改,现在terraform apply 工作正常。

    【讨论】:

      猜你喜欢
      • 2014-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-29
      • 2020-05-31
      • 2011-06-22
      • 2015-12-16
      • 2015-11-15
      相关资源
      最近更新 更多