hashicorp / hashicorp/hcl

Error during variable serialization in map

Open
#189 0 comments 0 reactions 0 assignees View on GitHub
v1
Dominant language
Go
Stars
5.8k
Forks
657
Avg merge
20h 36m
Merged PRs (30d)
6

Description

### HCL Template
```hcl
variable "baz" {
type = "map"

default = {
"A" = "a"
"0.0.0.0/0" = "i-123456"
}
}
```

### Expected behavior
I would expect "0.0.0.0/0" to be parsed as string.

### Actual behavior

```
An error has occurred while serializing the variables for uploading:
At 2:9: expected: IDENT | STRING | ASSIGN | LBRACE got: FLOAT
```

### Steps to reproduce
1. Use the example below in `command/test-fixtures/push-tfvars/main.tf`
2. Run `make test TEST=./command`

### References
- https://github.com/hashicorp/terraform/issues/11977

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with command/test-fixtures/push-tfvars/main.tf and run make test TEST=./command to reproduce the serialization error. Trace how the map key "0.0.0.0/0" is parsed during variable serialization; done when the fixture passes and the quoted key is handled as a string.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.