hashicorp / hashicorp/hcl

How can I read the second `hcl:",key"?

Open
#214 1 comment 5 reactions 0 assignees View on GitHub
v1
Dominant language
Go
Stars
5.8k
Forks
659
Avg merge
20h 36m
Merged PRs (30d)
6

Description

```
test "aws_subnet" "privatenet" {
vpc_id = "xxxx"
cidr_block = "xxxx"
availability_zone = "xxxx"
map_public_ip_on_launch = false

tags {
"Name" = "xxxx"
"terraform" = "true"
}
}
```

--------------------------------------------------------

Hi. I'm using this library for my work. but I can't read second title. "privatenet"

I'm testing this code.

```go
type Config struct {
Directories []DirectoryConfig `hcl:"test"`
}

type DirectoryConfig struct {
AwsSubnet string `hcl:",key"`
AwsSubnetName string // ????
VpcId string `hcl:"vpc_id"`
CidrBlock string `hcl:"cidr_block"`
AZ string `hcl:"availability_zone"`
MapPublicIpOnLaunch bool `hcl:"map_public_ip_on_launch"`
}
```

I want to read AwsSubnetName. But I don't know expression. I can't find it anywhere.

And other variables are not working except AwsSubnet.

Please help me.

Contributor guide

No contributing guide indexed for this repository

Research direction

The payload names no source file or test. Start by reproducing the Go decoding example against the supplied HCL input, then trace the library's handling of the hcl tags and labels. Done should mean the requested label and remaining attributes decode as intended, with a regression test documenting the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.