AWSAT005

package
v0.0.0-...-0ba5fd9 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: MPL-2.0 Imports: 9 Imported by: 3

README

AWSAT005

The AWSAT005 analyzer reports hardcoded AWS partitions in ARNs. For tests to work across AWS partitions, the partitions should not be hardcoded.

Flagged Code

func testAccAWSSpotFleetRequestConfig(role string) string {
	return fmt.Sprintf(`
resource "aws_iam_role_policy_attachment" "test-AmazonEKSClusterPolicy" {
  policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy"
  role       = %q
}
`, role)
}

Passing Code

func testAccAWSSpotFleetRequestConfig(role string) string {
    return fmt.Sprintf(`
data "aws_partition" "current" {}

resource "aws_iam_role_policy_attachment" "test-AmazonEKSClusterPolicy" {
  policy_arn = "arn:${data.aws_partition.current.partition}:iam::aws:policy/AmazonEKSClusterPolicy"
  role       = %q
}
`, role)
}

Ignoring Reports

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

policy_arn = "arn:aws:iam::aws:policy/AmazonEKSClusterPolicy" //lintignore:AWSAT005

Documentation

Overview

Package AWSAT005 defines an Analyzer that checks for hardcoded AWS partitions in ARNs

Index

Constants

View Source
const Doc = `` /* 189-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