opentofu/internal/configs/cloud.go
Christian Mesh 8f8e0aa4aa
Static Evaluation Base, Module Sources, Backend Config (#1718)
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
Signed-off-by: Christian Mesh <cristianmesh1@gmail.com>
Co-authored-by: James Humphries <James@james-humphries.co.uk>
Co-authored-by: Oleksandr Levchenkov <ollevche@gmail.com>
2024-06-24 09:13:07 -04:00

35 lines
679 B
Go

// Copyright (c) The OpenTofu Authors
// SPDX-License-Identifier: MPL-2.0
// Copyright (c) 2023 HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package configs
import (
"github.com/hashicorp/hcl/v2"
)
// Cloud represents a "cloud" block inside a "terraform" block in a module
// or file.
type CloudConfig struct {
Config hcl.Body
eval *StaticEvaluator
DeclRange hcl.Range
}
func decodeCloudBlock(block *hcl.Block) (*CloudConfig, hcl.Diagnostics) {
return &CloudConfig{
Config: block.Body,
DeclRange: block.DefRange,
}, nil
}
func (c *CloudConfig) ToBackendConfig() Backend {
return Backend{
Type: "cloud",
Config: c.Config,
Eval: c.eval,
}
}