Defer cloud block overrides

This restriction is temporary. Overrides should be allowed, but have the
added complexity of needing to also override a 'backend' block, so this
work is being deferred for now.
This commit is contained in:
Chris Arcand 2021-08-25 22:16:57 -05:00
parent fccc873a3d
commit 07b3d015d1
1 changed files with 12 additions and 0 deletions

View File

@ -392,6 +392,18 @@ func (m *Module) mergeFile(file *File) hcl.Diagnostics {
} }
} }
// TODO: This restriction is temporary. Overrides should be allowed, but have the added
// complexity of needing to also override a 'backend' block, so this work is being deferred
// for now.
for _, m := range file.CloudConfigs {
diags = append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Cannot override 'cloud' configuration",
Detail: "Terraform Cloud configuration blocks can appear only in normal files, not in override files.",
Subject: m.DeclRange.Ptr(),
})
}
for _, pc := range file.ProviderConfigs { for _, pc := range file.ProviderConfigs {
key := pc.moduleUniqueKey() key := pc.moduleUniqueKey()
existing, exists := m.ProviderConfigs[key] existing, exists := m.ProviderConfigs[key]