mirror of https://github.com/hashicorp/terraform
This is a replacement declaration for using Terraform Cloud as a remote backend, leaving the literal backend as an implementation detail and not a user-level concept.pull/29826/head
parent
a5f063625a
commit
a4c24e3147
@ -0,0 +1,27 @@
|
||||
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
|
||||
|
||||
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,
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
terraform {
|
||||
# Only the root module can declare a Cloud configuration. Terraform should emit a warning
|
||||
# about this child module Cloud declaration.
|
||||
cloud {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
module "child" {
|
||||
source = "./child"
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
|
||||
terraform {
|
||||
cloud {
|
||||
foo = "bar"
|
||||
|
||||
baz {
|
||||
bar = "foo"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue