Skip to content

Commit e404074

Browse files
terraform: Update a few tests for new provider FQNs
These will now use "default" provider addresses, rather than "legacy" ones, so that they can cooperate with the rest of Terraform that has been updated to no longer use legacy provider addresses.
1 parent 3e3d8f6 commit e404074

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

terraform/context_plan_test.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5789,26 +5789,24 @@ resource "aws_instance" "foo" {
57895789
Status: states.ObjectReady,
57905790
AttrsJSON: []byte(`{"id":"child"}`),
57915791
},
5792-
mustProviderConfig(`provider["registry.terraform.io/-/aws"]`),
5792+
mustProviderConfig(`provider["registry.terraform.io/hashicorp/aws"]`),
57935793
)
57945794
state.EnsureModule(addrs.RootModuleInstance.Child("mod", addrs.IntKey(1))).SetResourceInstanceCurrent(
57955795
mustResourceInstanceAddr("aws_instance.foo").Resource,
57965796
&states.ResourceInstanceObjectSrc{
57975797
Status: states.ObjectReady,
57985798
AttrsJSON: []byte(`{"id":"child"}`),
57995799
},
5800-
mustProviderConfig(`provider["registry.terraform.io/-/aws"]`),
5800+
mustProviderConfig(`provider["registry.terraform.io/hashicorp/aws"]`),
58015801
)
58025802

58035803
p := testProvider("aws")
58045804
p.DiffFn = testDiffFn
58055805
ctx := testContext2(t, &ContextOpts{
58065806
Config: m,
5807-
ProviderResolver: providers.ResolverFixed(
5808-
map[addrs.Provider]providers.Factory{
5809-
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
5810-
},
5811-
),
5807+
Providers: map[addrs.Provider]providers.Factory{
5808+
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
5809+
},
58125810
State: state,
58135811
})
58145812

terraform/context_validate_test.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,11 +1452,9 @@ resource "aws_instance" "foo" {
14521452
p.DiffFn = testDiffFn
14531453
ctx := testContext2(t, &ContextOpts{
14541454
Config: m,
1455-
ProviderResolver: providers.ResolverFixed(
1456-
map[addrs.Provider]providers.Factory{
1457-
addrs.NewLegacyProvider("aws"): testProviderFuncFixed(p),
1458-
},
1459-
),
1455+
Providers: map[addrs.Provider]providers.Factory{
1456+
addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p),
1457+
},
14601458
})
14611459

14621460
diags := ctx.Validate()

terraform/graph_builder_refresh_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"strings"
55
"testing"
66

7+
"github.com/google/go-cmp/cmp"
78
"github.com/hashicorp/terraform/addrs"
89
"github.com/hashicorp/terraform/states"
910
)
@@ -62,7 +63,7 @@ provider["registry.terraform.io/hashicorp/test"] (close) - *terraform.graphNodeC
6263
test_object.foo[1] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
6364
test_object.foo[2] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
6465
root - *terraform.nodeCloseModule
65-
provider["registry.terraform.io/-/test"] (close) - *terraform.graphNodeCloseProvider
66+
provider["registry.terraform.io/hashicorp/test"] (close) - *terraform.graphNodeCloseProvider
6667
test_object.foo - *terraform.nodeExpandRefreshableManagedResource
6768
provider["registry.terraform.io/hashicorp/test"] - *terraform.NodeApplyableProvider
6869
test_object.foo[0] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstanceObject
@@ -73,6 +74,6 @@ test_object.foo[2] (deposed 00000001) - *terraform.NodePlanDeposedResourceInstan
7374
provider["registry.terraform.io/hashicorp/test"] - *terraform.NodeApplyableProvider
7475
`)
7576
if expected != actual {
76-
t.Fatalf("wrong result\n\ngot:\n%s\n\nwant:\n%s", actual, expected)
77+
t.Fatalf("wrong result\n\ngot:\n%s\n\nwant:\n%s\ndiff:\n%s", actual, expected, cmp.Diff(expected, actual))
7778
}
7879
}

0 commit comments

Comments
 (0)