Skip to content

states/statemgr: Print backend name in lock Info #20006

@radeksimko

Description

@radeksimko

Current Terraform Version

v0.12.0-dev

Use-cases

Debugging, mainly.

Proposal

Terraform currently exposes the following info about a lock:

// String return a multi-line string representation of LockInfo
func (l *LockInfo) String() string {
tmpl := `Lock Info:
ID: {{.ID}}
Path: {{.Path}}
Operation: {{.Operation}}
Who: {{.Who}}
Version: {{.Version}}
Created: {{.Created}}
Info: {{.Info}}
`

which can make it a bit difficult to even embark on any debugging route as one first has to understand where to look (filesystem or any particular remote storage).

I think it would be helpful to expose the name of the backend which holds the lock, e.g.

Lock Info:
  ID:        a7870da6-a5a2-3e83-54f5-28ace4d5bb7c
  Backend:   s3
  Path:      terraform.tfstate
  Operation: OperationTypeApply
  Who:       radeksimko@local
  Version:   0.12.0
  Created:   2019-01-13 23:02:37.282887 +0000 UTC
  Info:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions