mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
parent
189820b6ea
commit
36aac6b498
@ -190,12 +190,12 @@ func (mc *ModuleCall) merge(omc *ModuleCall) hcl.Diagnostics {
|
||||
|
||||
// We don't allow depends_on to be overridden because that is likely to
|
||||
// cause confusing misbehavior.
|
||||
if len(mc.DependsOn) != 0 {
|
||||
if len(omc.DependsOn) != 0 {
|
||||
diags = append(diags, &hcl.Diagnostic{
|
||||
Severity: hcl.DiagError,
|
||||
Summary: "Unsupported override",
|
||||
Detail: "The depends_on argument may not be overridden.",
|
||||
Subject: mc.DependsOn[0].SourceRange().Ptr(), // the first item is the closest range we have
|
||||
Subject: omc.DependsOn[0].SourceRange().Ptr(), // the first item is the closest range we have
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -117,6 +117,26 @@ func TestModuleOverrideModule(t *testing.T) {
|
||||
Byte: 17,
|
||||
},
|
||||
},
|
||||
DependsOn: []hcl.Traversal{
|
||||
{
|
||||
hcl.TraverseRoot{
|
||||
Name: "null_resource",
|
||||
SrcRange: hcl.Range{
|
||||
Filename: "testdata/valid-modules/override-module/primary.tf",
|
||||
Start: hcl.Pos{Line: 11, Column: 17, Byte: 149},
|
||||
End: hcl.Pos{Line: 11, Column: 30, Byte: 162},
|
||||
},
|
||||
},
|
||||
hcl.TraverseAttr{
|
||||
Name: "test",
|
||||
SrcRange: hcl.Range{
|
||||
Filename: "testdata/valid-modules/override-module/primary.tf",
|
||||
Start: hcl.Pos{Line: 11, Column: 30, Byte: 162},
|
||||
End: hcl.Pos{Line: 11, Column: 35, Byte: 167},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Providers: []PassedProviderConfig{
|
||||
{
|
||||
InChild: &ProviderConfigRef{
|
||||
|
@ -8,4 +8,6 @@ module "example" {
|
||||
providers = {
|
||||
test = test.foo
|
||||
}
|
||||
depends_on = [null_resource.test]
|
||||
}
|
||||
resource "null_resource" "test" {}
|
||||
|
Loading…
Reference in New Issue
Block a user