From c002bab730611d971e141e0d30c604038425e3b3 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Mon, 20 Jun 2022 14:19:41 -0400 Subject: [PATCH] update test fixtures for better imports --- internal/terraform/context_import_test.go | 16 +++++++++++++++- .../terraform/testdata/import-provider/main.tf | 1 - 2 files changed, 15 insertions(+), 2 deletions(-) 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" }