Skip to content

tfexec Terraform.Output method returns error when command is successful #470

Open
@Ravikc

Description

@Ravikc

I am using terraform-exec with HCP terraform to manage some infra. When running terraform output command, logs show that there was a connection error and it's trying to re-establish the connection, eventually the command logs the correct output, but Terraform.Output method returns an error.

Expected behaviour: error returned by Terraform.Output should be nil.

Error returned by the library:
invalid character 'T' looking for beginning of value

Logs:

time=2024-07-11T13:06:33.111Z level=INFO msg="[INFO] running Terraform command: /home/terraform/app/terraform output -no-color -json"

There was an error connecting to HCP Terraform. Please do not exit
Terraform to prevent data loss! Trying to restore the connection...

Still trying to restore the connection... (3s elapsed)
Still trying to restore the connection... (5s elapsed)
Still trying to restore the connection... (8s elapsed)
Still trying to restore the connection... (12s elapsed)
Still trying to restore the connection... (17s elapsed)
{
  "ubuntu1_public_dns": {
    "sensitive": false,
    "type": "string",
    "value": "<some-value-here>"
  },
  "ubuntu_public_dns": {
    "sensitive": false,
    "type": "string",
    "value": "<some-value-here>"
  }
}

It's probably failing when trying to convert the command's output into map[string]OutputMeta

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions