AT004

Acceptance testsStandard

check for TestStep Config containing provider configuration

The AT004 analyzer reports likely incorrect uses of TestStep Config which define a provider configuration. Provider configurations should be handled outside individual test configurations (e.g. environment variables).

Examples

const ExampleThingConfig = `
provider "example" {}

resource "example_thing" {}
`

resource.TestCase{
    Steps: []resource.TestStep{
        {
            Config: ExampleThingConfig,
        },
    },
}
const ExampleThingConfig = `
resource "example_thing" {}
`

resource.TestCase{
    Steps: []resource.TestStep{
        {
            Config: ExampleThingConfig,
        },
    },
}

Ignoring reports

Singular reports can be ignored by adding a //lintignore:AT004 Go code comment at the end of the offending line or on the line immediately preceding, e.g.

//lintignore:AT004
const ExampleThingConfig = `
provider "example" {}

resource "example_thing" {}
`

This page is generated from passes/AT004/README.md, which lives beside the analyzer.