github.com/kcburge/terraform@v0.11.12-beta1/configs/backend.go (about)

     1  package configs
     2  
     3  import (
     4  	"github.com/hashicorp/hcl2/hcl"
     5  )
     6  
     7  // Backend represents a "backend" block inside a "terraform" block in a module
     8  // or file.
     9  type Backend struct {
    10  	Type   string
    11  	Config hcl.Body
    12  
    13  	TypeRange hcl.Range
    14  	DeclRange hcl.Range
    15  }
    16  
    17  func decodeBackendBlock(block *hcl.Block) (*Backend, hcl.Diagnostics) {
    18  	return &Backend{
    19  		Type:      block.Labels[0],
    20  		TypeRange: block.LabelRanges[0],
    21  		Config:    block.Body,
    22  		DeclRange: block.DefRange,
    23  	}, nil
    24  }