diff --git a/internal/terraform/context_import_test.go b/internal/terraform/context_import_test.go index 605010d17569..4e206d632af9 100644 --- a/internal/terraform/context_import_test.go +++ b/internal/terraform/context_import_test.go @@ -52,9 +52,20 @@ func TestContextImport_basic(t *testing.T) { } } +// import 1 of count instances in the configuration func TestContextImport_countIndex(t *testing.T) { p := testProvider("aws") - m := testModule(t, "import-provider") + m := testModuleInline(t, map[string]string{ + "main.tf": ` +provider "aws" { + foo = "bar" +} + +resource "aws_instance" "foo" { + count = 2 +} +`}) + ctx := testContext2(t, &ContextOpts{ Providers: map[addrs.Provider]providers.Factory{ addrs.NewDefaultProvider("aws"): testProviderFuncFixed(p), @@ -797,6 +808,9 @@ module "b" { source = "./b" y = module.a[each.key].y } + +resource "test_resource" "test" { +} `, "a/main.tf": ` output "y" { diff --git a/internal/terraform/testdata/import-provider/main.tf b/internal/terraform/testdata/import-provider/main.tf index 328624e0d991..5d41fb3e6162 100644 --- a/internal/terraform/testdata/import-provider/main.tf +++ b/internal/terraform/testdata/import-provider/main.tf @@ -3,5 +3,4 @@ provider "aws" { } resource "aws_instance" "foo" { - #id = "bar" }