github.com/terramate-io/tf@v0.0.0-20230830114523-fce866b4dfcd/configs/cloud.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package configs
     5  
     6  import (
     7  	"github.com/hashicorp/hcl/v2"
     8  )
     9  
    10  // Cloud represents a "cloud" block inside a "terraform" block in a module
    11  // or file.
    12  type CloudConfig struct {
    13  	Config hcl.Body
    14  
    15  	DeclRange hcl.Range
    16  }
    17  
    18  func decodeCloudBlock(block *hcl.Block) (*CloudConfig, hcl.Diagnostics) {
    19  	return &CloudConfig{
    20  		Config:    block.Body,
    21  		DeclRange: block.DefRange,
    22  	}, nil
    23  }
    24  
    25  func (c *CloudConfig) ToBackendConfig() Backend {
    26  	return Backend{
    27  		Type:   "cloud",
    28  		Config: c.Config,
    29  	}
    30  }