Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tftest.hcl command conversion #108

Open
konradzagozda opened this issue Dec 1, 2024 · 1 comment
Open

tftest.hcl command conversion #108

konradzagozda opened this issue Dec 1, 2024 · 1 comment

Comments

@konradzagozda
Copy link

konradzagozda commented Dec 1, 2024

I have file with test sth.tftest.hcl:

run "test_nothing" {
    command = plan
}

I attempt to convert it to json:
and i get:

{
  "run": {
    "test_nothing": [
      {
        "command": "${plan}"
      }
    ]
  },
}

when I try to run terraform test on first version it's fine but when i try to run it on json version it errors with:

│ Error: Invalid "command" keyword
│ 
│   on tests-out/sth.tftest.json line 5, in run.test_nothing[0]:
│    5:         "command": "${plan}"
│ 
│ The "command" argument requires one of the following keywords without
│ quotes: apply or plan.

Is this hcl2json conversion issue or terraform issue?

@tmccombs
Copy link
Owner

tmccombs commented Dec 1, 2024

It's a "accurately converting hcl to json in all cases requires knowledge of the schema" problem.

This is basically the same problem as #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants