Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/configs/module_merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}

Expand Down
20 changes: 20 additions & 0 deletions internal/configs/module_merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ module "example" {
providers = {
test = test.foo
}
depends_on = [null_resource.test]
}
resource "null_resource" "test" {}