diff --git a/plancheck/expect_null_output_value_at_path_test.go b/plancheck/expect_null_output_value_at_path_test.go index 350ff4a33..6d183b626 100644 --- a/plancheck/expect_null_output_value_at_path_test.go +++ b/plancheck/expect_null_output_value_at_path_test.go @@ -12,12 +12,20 @@ import ( r "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" + "github.com/hashicorp/terraform-plugin-testing/tfversion" ) func Test_ExpectNullOutputValueAtPath_StringAttribute_EmptyConfig(t *testing.T) { t.Parallel() r.Test(t, r.TestCase{ + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { ProviderFactories: map[string]func() (*schema.Provider, error){ @@ -46,6 +54,13 @@ func Test_ExpectNullOutputValueAtPath_StringAttribute_NullConfig(t *testing.T) { t.Parallel() r.Test(t, r.TestCase{ + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { ProviderFactories: map[string]func() (*schema.Provider, error){ @@ -75,6 +90,13 @@ func Test_ExpectNullOutputValueAtPath_StringAttribute_ExpectErrorNotNull(t *test t.Parallel() r.Test(t, r.TestCase{ + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { ProviderFactories: map[string]func() (*schema.Provider, error){ @@ -110,6 +132,13 @@ func Test_ExpectNullOutputValueAtPath_ListAttribute_EmptyConfig(t *testing.T) { return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -138,6 +167,13 @@ func Test_ExpectNullOutputValueAtPath_ListAttribute_NullConfig(t *testing.T) { return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -167,6 +203,13 @@ func Test_ExpectNullOutputValueAtPath_ListAttribute_ExpectErrorNotNull(t *testin return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -197,6 +240,13 @@ func Test_ExpectNullOutputValueAtPath_SetAttribute_EmptyConfig(t *testing.T) { return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -225,6 +275,13 @@ func Test_ExpectNullOutputValueAtPath_SetAttribute_NullConfig(t *testing.T) { return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -254,6 +311,13 @@ func Test_ExpectNullOutputValueAtPath_SetAttribute_ExpectErrorNotNull(t *testing return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -284,6 +348,13 @@ func Test_ExpectNullOutputValueAtPath_MapAttribute_EmptyConfig(t *testing.T) { return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -312,6 +383,13 @@ func Test_ExpectNullOutputValueAtPath_MapAttribute_NullConfig(t *testing.T) { return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -341,6 +419,13 @@ func Test_ExpectNullOutputValueAtPath_MapAttribute_ExpectErrorNotNull(t *testing return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -374,6 +459,13 @@ func Test_ExpectNullOutputValueAtPath_MapAttribute_PartiallyNullConfig_ExpectErr return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -407,6 +499,13 @@ func Test_ExpectNullOutputValueAtPath_ListNestedBlock_EmptyConfig(t *testing.T) return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -436,6 +535,13 @@ func Test_ExpectNullOutputValueAtPath_ListNestedBlock_NullConfig(t *testing.T) { return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -467,6 +573,13 @@ func Test_ExpectNullOutputValueAtPath_ListNestedBlock_ExpectErrorNotNull(t *test return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { @@ -499,6 +612,13 @@ func Test_ExpectNullOutputValueAtPath_SetNestedBlock_NullConfig_ExpectErrorNotNu return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: `resource "test_resource" "test" { diff --git a/plancheck/expect_unknown_output_value_at_path_test.go b/plancheck/expect_unknown_output_value_at_path_test.go index 5518ce6b0..a766bb39a 100644 --- a/plancheck/expect_unknown_output_value_at_path_test.go +++ b/plancheck/expect_unknown_output_value_at_path_test.go @@ -12,6 +12,7 @@ import ( r "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" + "github.com/hashicorp/terraform-plugin-testing/tfversion" ) func Test_ExpectUnknownOutputValueAtPath_StringAttribute(t *testing.T) { @@ -23,6 +24,11 @@ func Test_ExpectUnknownOutputValueAtPath_StringAttribute(t *testing.T) { Source: "terraform.io/builtin/terraform", }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_4_0), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -57,6 +63,11 @@ func Test_ExpectUnknownOutputValueAtPath_ListAttribute(t *testing.T) { return testProvider(), nil }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_4_0), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -95,6 +106,11 @@ func Test_ExpectUnknownOutputValueAtPath_SetAttribute(t *testing.T) { return testProvider(), nil }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_4_0), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -133,6 +149,11 @@ func Test_ExpectUnknownOutputValueAtPath_MapAttribute(t *testing.T) { return testProvider(), nil }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_4_0), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -174,6 +195,11 @@ func Test_ExpectUnknownOutputValueAtPath_ListNestedBlock_Resource(t *testing.T) return testProvider(), nil }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_4_0), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -214,6 +240,11 @@ func Test_ExpectUnknownOutputValueAtPath_ListNestedBlock_ResourceBlocks(t *testi return testProvider(), nil }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_4_0), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -254,6 +285,11 @@ func Test_ExpectUnknownOutputValueAtPath_ListNestedBlock_ObjectBlockIndex(t *tes return testProvider(), nil }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_4_0), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -294,6 +330,11 @@ func Test_ExpectUnknownOutputValueAtPath_SetNestedBlock_Object(t *testing.T) { return testProvider(), nil }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_4_0), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -329,6 +370,13 @@ func Test_ExpectUnknownOutputValueAtPath_ExpectError_KnownValue(t *testing.T) { return testProvider(), nil }, }, + // Prior to Terraform v1.3.0 a planned output is marked as fully unknown + // if any attribute is unknown. The id attribute within the test provider + // is unknown. + // Reference: https://github.com/hashicorp/terraform/blob/v1.3/CHANGELOG.md#130-september-21-2022 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(tfversion.Version1_3_0), + }, Steps: []r.TestStep{ { Config: ` diff --git a/plancheck/expect_unknown_output_value_test.go b/plancheck/expect_unknown_output_value_test.go index 6371693eb..376303514 100644 --- a/plancheck/expect_unknown_output_value_test.go +++ b/plancheck/expect_unknown_output_value_test.go @@ -7,10 +7,12 @@ import ( "regexp" "testing" + "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" r "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/tfversion" ) func Test_ExpectUnknownOutputValue_StringAttribute(t *testing.T) { @@ -22,6 +24,11 @@ func Test_ExpectUnknownOutputValue_StringAttribute(t *testing.T) { Source: "terraform.io/builtin/terraform", }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(version.Must(version.NewVersion("1.4.0"))), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -56,6 +63,11 @@ func Test_ExpectUnknownOutputValue_ListAttribute(t *testing.T) { return testProvider(), nil }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(version.Must(version.NewVersion("1.4.0"))), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -94,6 +106,11 @@ func Test_ExpectUnknownOutputValue_SetAttribute(t *testing.T) { return testProvider(), nil }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(version.Must(version.NewVersion("1.4.0"))), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -132,6 +149,11 @@ func Test_ExpectUnknownOutputValue_MapAttribute(t *testing.T) { return testProvider(), nil }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(version.Must(version.NewVersion("1.4.0"))), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" { @@ -173,6 +195,11 @@ func Test_ExpectUnknownOutputValue_ListNestedBlock(t *testing.T) { return testProvider(), nil }, }, + // The terraform_data resource is not available prior to Terraform v1.4.0 + // Reference: https://github.com/hashicorp/terraform/blob/v1.4/CHANGELOG.md#140-march-08-2023 + TerraformVersionChecks: []tfversion.TerraformVersionCheck{ + tfversion.SkipBelow(version.Must(version.NewVersion("1.4.0"))), + }, Steps: []r.TestStep{ { Config: `resource "terraform_data" "one" {