github.com/hashicorp/terraform-plugin-sdk@v1.17.2/internal/configs/provider_test.go (about)

     1  package configs
     2  
     3  import (
     4  	"io/ioutil"
     5  	"testing"
     6  )
     7  
     8  func TestProviderReservedNames(t *testing.T) {
     9  	src, err := ioutil.ReadFile("testdata/invalid-files/provider-reserved.tf")
    10  	if err != nil {
    11  		t.Fatal(err)
    12  	}
    13  	parser := testParser(map[string]string{
    14  		"config.tf": string(src),
    15  	})
    16  	_, diags := parser.LoadConfigFile("config.tf")
    17  
    18  	assertExactDiagnostics(t, diags, []string{
    19  		`config.tf:10,3-8: Reserved argument name in provider block; The provider argument name "count" is reserved for use by Terraform in a future version.`,
    20  		`config.tf:11,3-13: Reserved argument name in provider block; The provider argument name "depends_on" is reserved for use by Terraform in a future version.`,
    21  		`config.tf:12,3-11: Reserved argument name in provider block; The provider argument name "for_each" is reserved for use by Terraform in a future version.`,
    22  		`config.tf:14,3-12: Reserved block type name in provider block; The block type name "lifecycle" is reserved for use by Terraform in a future version.`,
    23  		`config.tf:15,3-9: Reserved block type name in provider block; The block type name "locals" is reserved for use by Terraform in a future version.`,
    24  		`config.tf:13,3-9: Reserved argument name in provider block; The provider argument name "source" is reserved for use by Terraform in a future version.`,
    25  	})
    26  }