AT004

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2024 License: MPL-2.0 Imports: 7 Imported by: 2

README

AT004

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).

Flagged Code

const ExampleThingConfig = `
provider "example" {}

resource "example_thing" {}
`

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

Passing Code

const ExampleThingConfig = `
resource "example_thing" {}
`

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

Ignoring Reports

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

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

resource "example_thing" {}
`

Documentation

Overview

Package AT004 defines an Analyzer that checks for TestStep Config containing provider configuration

Index

Constants

View Source
const Doc = `` /* 278-byte string literal not displayed */

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name: analyzerName,
	Doc:  Doc,
	Requires: []*analysis.Analyzer{
		commentignore.Analyzer,
		inspect.Analyzer,
	},
	Run: run,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL