aws

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2021 License: MPL-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AwsProviderAssumeRoleBlockShema = &hcl.BodySchema{
	Attributes: []hcl.AttributeSchema{
		{Name: "role_arn", Required: true},
		{Name: "session_name"},
		{Name: "external_id"},
		{Name: "policy"},
	},
}

AwsProviderAssumeRoleBlockShema is a schema of `assume_role` block

View Source
var AwsProviderBlockSchema = &hcl.BodySchema{
	Attributes: []hcl.AttributeSchema{
		{Name: "access_key"},
		{Name: "secret_key"},
		{Name: "profile"},
		{Name: "shared_credentials_file"},
		{Name: "region"},
	},
	Blocks: []hcl.BlockHeaderSchema{
		{Type: "assume_role"},
	},
}

AwsProviderBlockSchema is a schema of `aws` provider block

Functions

This section is empty.

Types

type Client

Client is a wrapper of the AWS SDK client It has interfaces for each services to make testing easier

func NewClient

func NewClient(creds Credentials) (*Client, error)

NewClient returns a new Client with configured session

func (*Client) DescribeCacheParameterGroups

func (c *Client) DescribeCacheParameterGroups() (map[string]bool, error)

DescribeCacheParameterGroups is a wrapper of DescribeCacheParameterGroups

func (*Client) DescribeCacheSubnetGroups

func (c *Client) DescribeCacheSubnetGroups() (map[string]bool, error)

DescribeCacheSubnetGroups is a wrapper of DescribeCacheSubnetGroups

func (*Client) DescribeDBParameterGroups

func (c *Client) DescribeDBParameterGroups() (map[string]bool, error)

DescribeDBParameterGroups is a wrapper of DescribeDBParameterGroups

func (*Client) DescribeDBSubnetGroups

func (c *Client) DescribeDBSubnetGroups() (map[string]bool, error)

DescribeDBSubnetGroups is a wrapper of DescribeDBSubnetGroups

func (*Client) DescribeEgressOnlyInternetGateways

func (c *Client) DescribeEgressOnlyInternetGateways() (map[string]bool, error)

DescribeEgressOnlyInternetGateways is wrapper of DescribeEgressOnlyInternetGateways

func (*Client) DescribeInstances

func (c *Client) DescribeInstances() (map[string]bool, error)

DescribeInstances is a wrapper of DescribeInstances

func (*Client) DescribeInternetGateways

func (c *Client) DescribeInternetGateways() (map[string]bool, error)

DescribeInternetGateways is a wrapper of DescribeInternetGateways

func (*Client) DescribeKeyPairs

func (c *Client) DescribeKeyPairs() (map[string]bool, error)

DescribeKeyPairs is a wrapper of DescribeKeyPairs

func (*Client) DescribeNatGateways

func (c *Client) DescribeNatGateways() (map[string]bool, error)

DescribeNatGateways is a wrapper of DescribeNatGateways

func (*Client) DescribeNetworkInterfaces

func (c *Client) DescribeNetworkInterfaces() (map[string]bool, error)

DescribeNetworkInterfaces is a wrapper of DescribeNetworkInterfaces

func (*Client) DescribeOptionGroups

func (c *Client) DescribeOptionGroups() (map[string]bool, error)

DescribeOptionGroups is a wrapper of DescribeOptionGroups

func (*Client) DescribeRouteTables

func (c *Client) DescribeRouteTables() (map[string]bool, error)

DescribeRouteTables is a wrapper of DescribeRouteTables

func (*Client) DescribeSecurityGroups

func (c *Client) DescribeSecurityGroups() (map[string]bool, error)

DescribeSecurityGroups is a wrapper of DescribeSecurityGroups

func (*Client) DescribeSubnets

func (c *Client) DescribeSubnets() (map[string]bool, error)

DescribeSubnets is a wrapper of DescribeSubnets

func (*Client) DescribeVpcPeeringConnections

func (c *Client) DescribeVpcPeeringConnections() (map[string]bool, error)

DescribeVpcPeeringConnections is a wrapper of DescribeVpcPeeringConnections

func (*Client) ListInstanceProfiles

func (c *Client) ListInstanceProfiles() (map[string]bool, error)

ListInstanceProfiles is a wrapper of ListInstanceProfiles

type Config

type Config struct {
	DeepCheck             bool   `hcl:"deep_check,optional"`
	AccessKey             string `hcl:"access_key,optional"`
	SecretKey             string `hcl:"secret_key,optional"`
	Region                string `hcl:"region,optional"`
	Profile               string `hcl:"profile,optional"`
	SharedCredentialsFile string `hcl:"shared_credentials_file,optional"`

	Remain hcl.Body `hcl:",remain"`
}

Config is the configuration for the ruleset.

type Credentials

type Credentials struct {
	AccessKey             string
	SecretKey             string
	Profile               string
	CredsFile             string
	AssumeRoleARN         string
	AssumeRoleExternalID  string
	AssumeRolePolicy      string
	AssumeRoleSessionName string
	Region                string
}

Credentials is credentials for AWS used in deep check mode

func GetCredentialsFromProvider

func GetCredentialsFromProvider(runner tflint.Runner) (Credentials, error)

GetCredentialsFromProvider retrieves credentials from the "provider" block in the Terraform configuration

func (Credentials) Merge

func (c Credentials) Merge(other Credentials) Credentials

Merge returns a merged credentials

type ProviderData

type ProviderData struct {
	// contains filtered or unexported fields
}

ProviderData represents a provider block with an eval context (runner)

func (*ProviderData) Get

func (d *ProviderData) Get(key string) (string, bool, error)

Get returns a value corresponding to the given key It should be noted that the value is evaluated if it is evaluable The second return value is a flag that determines whether a value exists We assume the provider has only simple attributes, so it just returns string

func (*ProviderData) GetBlock

func (d *ProviderData) GetBlock(key string, schema *hcl.BodySchema) (*ProviderData, bool, error)

GetBlock returns a value just like Get. The difference is that GetBlock returns ProviderData rather than a string value.

type RuleSet

type RuleSet struct {
	tflint.BuiltinRuleSet
	APIRules []tflint.Rule
	// contains filtered or unexported fields
}

RuleSet is the custom ruleset for the AWS provider plugin.

func (*RuleSet) ApplyConfig

func (r *RuleSet) ApplyConfig(config *tflint.Config) error

ApplyConfig reflects the plugin configuration to the ruleset.

func (*RuleSet) Check

func (r *RuleSet) Check(rr tflint.Runner) error

Check runs inspections for each rule with the custom AWS runner.

func (*RuleSet) RuleNames added in v0.1.2

func (r *RuleSet) RuleNames() []string

RuleNames is a list of rule names provided by the plugin.

type Runner

type Runner struct {
	tflint.Runner
	PluginConfig *Config
	AwsClient    *Client
}

Runner is a wrapper of RPC client for inserting custom actions for AWS provider.

func NewRunner

func NewRunner(runner tflint.Runner, config *Config) (*Runner, error)

NewRunner returns a custom AWS runner.

func (*Runner) EachStringSliceExprs

func (r *Runner) EachStringSliceExprs(expr hcl.Expression, proc func(val string, expr hcl.Expression)) error

EachStringSliceExprs iterates an evaluated value and the corresponding expression If the given expression is a static list, get an expression for each value If not, the given expression is used as it is

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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