Documentation ¶
Index ¶
- func CanDisplayReadableTerraformPolicyChanges() bool
- func ReadableTerraformPolicyChanges(terraformChanges string) (string, error)
- func VersionMatches(v *version.Version, versionConstraint string) bool
- type Config
- type PlanResult
- type Result
- type Session
- func (s *Session) Apply() (Result, error)
- func (s *Session) Detach() (Result, error)
- func (s *Session) Get() (Result, error)
- func (s *Session) Init() (Result, error)
- func (s *Session) InitLocal() (Result, error)
- func (s *Session) Initialized() bool
- func (s *Session) Plan() (Result, error)
- func (s *Session) SetTerraformPath(path string)
- func (s *Session) Show(planFile string) (Result, error)
- func (s *Session) Version() (*version.Version, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanDisplayReadableTerraformPolicyChanges ¶
func CanDisplayReadableTerraformPolicyChanges() bool
CanDisplayReadableTerraformPolicyChanges is true when the prerequisites for ReadableTerraformPolicyChanges are fulfilled
func ReadableTerraformPolicyChanges ¶
ReadableTerraformPolicyChanges takes the output of `terraform plan` and rewrites policy diff to be in unified diff format
func VersionMatches ¶
VersionMatches returns whether or not the version matches the constraint. A constraint is a string like ">0.7.0" or "<1". See the go-version documentation for more info: https://github.com/hashicorp/go-version If an invalid constraint string is specified, this function will always return false.
Types ¶
type Config ¶
type Config struct { // Name is a unique name for this Terraform module. Name string // BasePath is the base path to the Terraform code. BasePath string // ModulePath is the path to the module, relative to the basepath. ModulePath string // Remote is the Terraform remote configuration for this module. Remote conf.Remote // Variables is a map of the variable values for execution. Variables map[string]string // TerraformParameters is a list of additional Terraform command-line parameters TerraformParameters []string // TerraformPath is the path to the Terraform binary TerraformPath string // plugins. SharedPluginDir string }
Config is the Terraform configuration required to initialize and run Terraform commands for a module.
type PlanResult ¶
type PlanResult struct {
// contains filtered or unexported fields
}
PlanResult is the terraformResult of a Terraform plan.
func (*PlanResult) Changes ¶
func (r *PlanResult) Changes() string
Changes returns the changes for this plan.
func (*PlanResult) HasChanges ¶
func (r *PlanResult) HasChanges() bool
HasChanges returns whether this plan had changes or not.
func (PlanResult) Runtime ¶
func (r PlanResult) Runtime() string
Runtime returns a human readable string with how long it took to run the command.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is a wrapper around Terraform commands. It ensures that all commands are run within the same working directory.
It also adds "auto init", meaning it will automatically run `terraform init` and `terraform get` as necessary before planning or applying.
func NewTerraformSession ¶
NewTerraformSession creates a new Terraform session in the specified directory. It will return an error if a previous Terraform session was already created here.
func (*Session) Detach ¶
Detach disables any connection to the remote state for the given module. If the module is not initialized, it does that first, and then disconnects it. This is so that Terraform first downloads the remote state locally. The purpose of Detach is to allow safe, local testing of changes to the state file, without pushing anything to the remote.
func (*Session) Init ¶
Init initializes a Terraform module. This needs to happen before other commands like "plan" and "apply" can be called. See: https://www.terraform.io/docs/commands/init.html
func (*Session) InitLocal ¶
InitLocal downloads the remote state files to the local session so that changes can be made to the state files locally without being pushed.
func (*Session) Initialized ¶
Initialized returns whether or not `terraform init` has been run.
func (*Session) SetTerraformPath ¶
SetTerraformPath sets the path to Terraform.