mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-29 10:21:01 -06:00
e15ec486bf
This is a first pass of decoding of the main Terraform configuration file format. It hasn't yet been tested with any real-world configurations, so it will need to be revised further as we test it more thoroughly.
25 lines
472 B
Go
25 lines
472 B
Go
package configs
|
|
|
|
import (
|
|
"github.com/hashicorp/hcl2/hcl"
|
|
)
|
|
|
|
// Backend represents a "backend" block inside a "terraform" block in a module
|
|
// or file.
|
|
type Backend struct {
|
|
Type string
|
|
Config hcl.Body
|
|
|
|
TypeRange hcl.Range
|
|
DeclRange hcl.Range
|
|
}
|
|
|
|
func decodeBackendBlock(block *hcl.Block) (*Backend, hcl.Diagnostics) {
|
|
return &Backend{
|
|
Type: block.Labels[0],
|
|
TypeRange: block.LabelRanges[0],
|
|
Config: block.Body,
|
|
DeclRange: block.DefRange,
|
|
}, nil
|
|
}
|