Terraform: Error refreshing state: Attribute name required

Created on 3 Jun 2019  ยท  6Comments  ยท  Source: hashicorp/terraform

Terraform Version

rsiwal@rsiwal-dell:~/git/terraforming-cp/cp-prod/mon$ terraform12 -v
Terraform v0.12.0

  • provider.aws v2.13.0
  • provider.template v2.1.2
...

Terraform Configuration Files

...

Debug Output

siwal@rsiwal-dell:~/git/terraforming-cp/cp-prod/mon$ TF_LOG=TRACE terraform12 init
2019/06/03 10:25:57 [INFO] Terraform version: 0.12.0
2019/06/03 10:25:57 [INFO] Go runtime version: go1.12.4
2019/06/03 10:25:57 [INFO] CLI args: []string{"/usr/local/bin/terraform12", "init"}
2019/06/03 10:25:57 [DEBUG] Attempting to open CLI config file: /home/rsiwal/.terraformrc
2019/06/03 10:25:57 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2019/06/03 10:25:57 [INFO] CLI command args: []string{"init"}

Initializing the backend...
2019/06/03 10:25:57 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2019/06/03 10:25:57 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2019/06/03 10:25:57 [DEBUG] New state was assigned lineage "9c4c74ea-189a-d1a3-80f2-a577711fe3d5"
2019/06/03 10:25:57 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
2019/06/03 10:25:57 [TRACE] Meta.Backend: instantiated backend of type
2019/06/03 10:25:57 [DEBUG] checking for provider in "."
2019/06/03 10:25:57 [DEBUG] checking for provider in "/usr/local/bin"
2019/06/03 10:25:57 [DEBUG] checking for provider in ".terraform/plugins/linux_amd64"
2019/06/03 10:25:57 [DEBUG] found provider "terraform-provider-aws_v2.13.0_x4"
2019/06/03 10:25:57 [DEBUG] found provider "terraform-provider-template_v2.1.2_x4"
2019/06/03 10:25:57 [DEBUG] found valid plugin: "aws", "2.13.0", "/home/rsiwal/git/terraforming-cp/cp-prod/mon/.terraform/plugins/linux_amd64/terraform-provider-aws_v2.13.0_x4"
2019/06/03 10:25:57 [DEBUG] found valid plugin: "template", "2.1.2", "/home/rsiwal/git/terraforming-cp/cp-prod/mon/.terraform/plugins/linux_amd64/terraform-provider-template_v2.1.2_x4"
2019/06/03 10:25:57 [DEBUG] checking for provisioner in "."
2019/06/03 10:25:57 [DEBUG] checking for provisioner in "/usr/local/bin"
2019/06/03 10:25:57 [DEBUG] checking for provisioner in ".terraform/plugins/linux_amd64"
2019/06/03 10:25:57 [TRACE] Meta.Backend: backend does not support operations, so wrapping it in a local backend
2019/06/03 10:25:57 [TRACE] backend/local: state manager for workspace "default" will:

  • read initial snapshot from terraform.tfstate
  • write new snapshots to terraform.tfstate
  • create any backup at terraform.tfstate.backup
    2019/06/03 10:25:57 [TRACE] statemgr.Filesystem: reading initial snapshot from terraform.tfstate
    Error refreshing state: Attribute name required: Dot must be followed by attribute name.
    rsiwal@rsiwal-dell:~/git/terraforming-cp/cp-prod/mon$

Crash Output

Error refreshing state: Attribute name required: Dot must be followed by attribute name.

Expected Behavior

It should update successfully

Actual Behavior

rsiwal@rsiwal-dell:~/git/terraforming-cp/cp-prod/mon$ terraform12 plan

Error: Error locking state: Error acquiring the state lock: Attribute name required: Dot must be followed by attribute name.

Terraform acquires a state lock to protect the state from being written
by multiple users at the same time. Please resolve the issue above and try
again. For most commands, you can disable locking with the "-lock=false"
flag, but this is not recommended.

-->

Steps to Reproduce

Upgrade terraform:
terraform init
terraform 0.12checklist
terraform12 init
terraform12 0.12upgrade

Additional Context

References

-->

bug core v0.12 waiting-response

Most helpful comment

I think this may have the same root cause as #21435.

All 6 comments

@rajneshsiwal Sorry you're having trouble. Could you provide more information about your config (removing any secrets) so that we might be able to reproduce this case?

In particular, this error: Error refreshing state: Attribute name required: Dot must be followed by attribute name. reads as if you might have a syntax error, so we'll need more information to correctly identify if this is an issue within Terraform itself.

@pselle I would like to avoid sharing the config file for security reason.
Is there any debug command that can be run to identify a file or section that might have led to the error.
As the logs with the trace are NOt pointingt to the actual error, its getting difficult for me to find the root cause

I think this may have the same root cause as #21435.

Hi @rajneshsiwal! Sorry for the long silence here.

As I posted in my comment about a year ago :upside_down_face: I think this had the same root cause as #21435, which was fixed some time ago. I expect your state contained a legacy resource dependency string like aws_instance.example.* which the 0.12 state parser couldn't previously handle.

Can you confirm whether you were eventually able to get this configuration working with a later version of Terraform 0.12? If you weren't, hopefully the newer version was at least able to produce a more helpful error message or item in the trace log that might give us a clue as to what issue remains. Thanks!

I am going to close this issue due to inactivity and the fact we think it's been resolved.

If there is still a question, I recommend the the community forum, where there are far more people available to help. If there is a bug or you would like to make a feature request, please open a new issue and fill out the template.
Thanks!

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings