2018-02-02 05:33:06 +01:00
|
|
|
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
|
|
|
|
|
2018-02-03 02:22:25 +01:00
|
|
|
TypeRange hcl.Range
|
2018-02-02 05:33:06 +01:00
|
|
|
DeclRange hcl.Range
|
|
|
|
}
|
2018-02-03 02:22:25 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
}
|