sdk

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Overview

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/

Copyright (C) HashiCorp, Inc.

This is a modified and enhanced version of the original source code.

The original source code contained in this file can be found at https://github.com/hashicorp/terraform-provider-aws/blob/bbefb8dfad459bc1846038b1da4c5857afe55bd9/aws/provider.go#L1314

Index

Constants

View Source
const KeyOutput = "output"

Variables

This section is empty.

Functions

func AWSCredsFromConfig

func AWSCredsFromConfig(conf *Config) (*session.Session, *sts.Credentials)

func AWSCredsFromValues

func AWSCredsFromValues(region, profile string, assumeRole *AssumeRoleConfig) (*session.Session, *sts.Credentials)

func AWSSession

func AWSSession(region, profile string, assumeRoleConfig *AssumeRoleConfig) *session.Session

func AssumeRole

func AssumeRole(sess *session.Session, config AssumeRoleConfig) (*session.Session, *sts.Credentials, error)

func Hash

func Hash(data interface{}) string

func NewSession

func NewSession(region, profile string) *session.Session

NewSession creates a new AWS session for the given AWS region.

The following credential sources are supported:

1. static credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) 2. static credentials loaded from profiles (AWS_PROFILE, when AWS_SDK_LOAD_CONFIG=true) 3. dynamic credentials obtained by assuming the role using static credentials loaded from the profile (AWS_PROFILE, when AWS_SDK_LOAD_CONFIG=true) 4. dynamic credentials obtained by assuming the role using static credentials loaded from the env (FORCE_AWS_PROFILE=true w/ credential_source=Environment)

The fourth option of using FORCE_AWS_PROFILE=true and AWS_PROFILE=yourprofile is equivalent to `aws --profile ${AWS_PROFILE}`. See https://github.com/variantdev/vals/issues/19#issuecomment-600437486 for more details and why and when this is needed.

func PrepareExecutable

func PrepareExecutable(defaultPath, pkgAndCmdName, pkgVersion string) (*string, error)

func SetOutput

func SetOutput(d *schema.ResourceData, v string)

Types

type AssumeRoleConfig

type AssumeRoleConfig struct {
	RoleARN           string
	DurationSeconds   int64
	ExternalID        string
	Policy            string
	PolicyARNs        []string
	SessionName       string
	Tags              map[string]string
	TransitiveTagKeys []string
}

type CommandResult

type CommandResult struct {
	Output     string
	ExitStatus int
}

CommandResult is a wrapper around both the input and output attributes that are relavent for updates

func NewCommandResult

func NewCommandResult() *CommandResult

NewCommandResult is the constructor for CommandResult

func Run

func Run(cmd *exec.Cmd) (*CommandResult, error)

type Config

type Config struct {
	Region     string
	Profile    string
	AssumeRole *AssumeRoleConfig
}

type Context

type Context struct {
	Creds *sts.Credentials
	Sess  *session.Session
}

func ContextConfig

func ContextConfig(conf *Config) *Context

func (*Context) Create

func (e *Context) Create(cmd *exec.Cmd, d *schema.ResourceData, id string) error

func (*Context) Delete

func (e *Context) Delete(cmd *exec.Cmd) error

func (*Context) Run

func (e *Context) Run(cmd *exec.Cmd) (*CommandResult, error)

func (*Context) Session

func (e *Context) Session() *session.Session

func (*Context) Update

func (e *Context) Update(cmd *exec.Cmd, d *schema.ResourceData) error

type Job

type Job struct {
	Conf *Config
}

func NewJob

func NewJob(conf *Config) *Job

func (*Job) Task

func (s *Job) Task(name string, f func(*Context) error) (err error)

type Outputter

type Outputter interface {
	Output(string)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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