github.com/paultyng/terraform@v0.6.11-0.20180227224804-66ff8f8bed40/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  }