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

[Bug]: importing deployment with JSON env var produces invalid Terraform code #172

Open
BasPH opened this issue Nov 18, 2024 · 0 comments
Open

Comments

@BasPH
Copy link
Collaborator

BasPH commented Nov 18, 2024

Description

I ran the import script on a Deployment that contains an environment variable containing a JSON value:

{ "foo": [ { "bar": "baz" } ]}

This produces a generated.tf without escaping the quotes, e.g.:

resource "astro_deployment" "deployment_clxx715jq0boq01k24diwbx3g" {
	...
	environment_variables = [{
		name = "MY_KEY"
		value = "{ "foo": [ { "bar": "baz" } ]}"
		is_secret = false
	}]
	...
}

Then running terraform plan shows an error:

$ terraform plan
╷
│ Error: Missing attribute separator
│
│   on generated.tf line 1526, in resource "astro_deployment" "deployment_clxx715jq0boq01k24diwbx3g":
│ 1524: 	environment_variables = [{
│ 1525: 		name = "MY_KEY"
│ 1526: 		value = "{ "foo": [ { "bar": "baz" } ]}"
│
│ Expected a newline or comma to mark the beginning of the next attribute.
╵

I obfuscated several values but can provide real values if needed. JSON values should be escaped to avoid breaking Terraform code.

Steps To Reproduce

No response

Acceptance Criteria

No response

Anything else?

No response

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

No branches or pull requests

1 participant