Configure project defaults or task specifics for Terraform
.
This also allows the terraform
executable to be set
It can be passed by a single map option.
// By tag (Gradle will download and cache the correct distribution).
executable tag : '0.10.1'
// By a physical path (
executable path : '/path/to/terraform'
// By using searchPath (will attempt to locate in search path).
executable searchPath()
If the build runs on a platform that supports downloading of the terraform
executable
the default will be to use the version as specified by TerraformExtension.TERRAFORM_DEFAULT,
otherwise it will be in search mode.
Modifiers | Name | Description |
---|---|---|
static java.lang.String |
NAME |
The standard extension name. |
static java.lang.String |
TERRAFORM_DEFAULT |
The default version of Terraform that will be used on a supported platform if nothing else is configured. |
Type | Name and description |
---|---|
java.util.Map<java.lang.String, ?> |
environment |
java.lang.Object |
localMirrorDirectory |
java.lang.Object |
netMirror |
Constructor and description |
---|
TerraformExtension
(Project project) Constructs a new extension which is attached to the provided project. |
TerraformExtension
(AbstractTerraformBaseTask task, java.util.List<TerraformExtensionConfigTypes> configExtensions) Constructs a new extension which is attached to the provided task. |
Type Params | Return Type | Name and description |
---|---|---|
|
java.util.Map<java.lang.String, java.lang.String> |
credentialsCacheFor(java.lang.String sourceSetName, java.lang.String workspaceName, Provider<java.util.Set<SessionCredentials>> creds) Returns a map of credentials for for a source set. |
|
void |
environment(java.util.Map<java.lang.String, ?> args) Add environmental variables to be passed to the exe. |
|
void |
executable(java.util.Map<java.lang.String, ?> opts) |
|
java.util.Set<java.lang.String> |
getAllPlatforms() Standard set of platforms. |
|
Variables |
getAllVariables() Returns all terraform variables and descriptions of variables within files within the specific context |
|
java.util.Map<java.lang.String, java.lang.String> |
getEnvironment() Environment for running the exe |
|
Provider<java.io.File> |
getLocalMirrorDirectory() An alternative local directory to look for provider packages rather than in upstream registries. |
|
Provider<java.lang.String> |
getNetMirror() An alternative network mirror service for provider packages. |
|
java.util.Set<java.lang.String> |
getPlatforms() Provide the list of platforms that need to be supported. |
|
boolean |
getWarnOnNewVersion() Print a warning message if a new version of terraform is available. |
|
void |
platforms(java.lang.Iterable<java.lang.String> reqPlatforms) Add one or more platforms to support for providers. |
|
void |
platforms(java.lang.String... reqPlatforms) Add one or more platforms to support for providers. |
|
TerraformMajorVersion |
resolveTerraformVersion() If the version is set via a version string return that, otherwise run terraform and parse the output |
|
static java.util.Map<java.lang.String, java.lang.Object> |
searchPath() Use this to configure a system path search for Terraform . |
|
void |
setEnvironment(java.util.Map<java.lang.String, ?> args) Replace current environment with new one. |
|
void |
setLocalMirrorDirectory(java.lang.Object path) Set an alternative local directory to look for provider packages rather than in upstream registries. |
|
void |
setNetMirror(java.lang.Object uri) Set an alternative network mirror service for provide packages. |
|
void |
setWarnOnNewVersion(boolean value) Turn checkpoint warning on or off |
|
java.lang.String |
terraformPath(java.lang.Object file) Converts a file path to a format suitable for interpretation by Terraform on the appropriate platform. |
|
void |
useAwsEnvironment() Adds AWS environmental variables to Terraform runtime environment. |
|
void |
warnOnNewVersion(boolean value) Turn checkpoint warning on or off |
The standard extension name.
The default version of Terraform that will be used on a supported platform if nothing else is configured.
Constructs a new extension which is attached to the provided project.
project
- Project this extension is associated with.Constructs a new extension which is attached to the provided task.
project
- Project this extension is associated with.configExtensions
- Configuration extensions that have to be added. Has to implement
TerraformExtensionEmbeddable interface.Returns a map of credentials for for a source set. This can be called multiple times during task execution as credentials may time out between tasks.
sourceSetName
- Name of source set.workspaceName
- Name of workspacecreds
- Session credential providers.Add environmental variables to be passed to the exe.
args
- Environmental variable key-value map.Standard set of platforms.
Returns all terraform variables and descriptions of variables within files within the specific context If this is a project extension only the global variable definitions are returned. If this is a task extension and globals are not ignored, then return a combination of the global variables, the source set variables and the local task extension variables. If this is a task extension and globals ignored, then return a combination of source set variables and the local task extension variables. Task extension variables overrides source set variables which in turn overrides global variables. Files containing variables are simply added to a list in order of global, source set, local.
Environment for running the exe
Calling this will resolve all lazy-values in the variable map.
An alternative local directory to look for provider packages rather than in upstream registries.
An alternative network mirror service for provider packages.
Provide the list of platforms that need to be supported. If empty, only the current platform will be supported.
Print a warning message if a new version of terraform
is available.
Add one or more platforms to support for providers. Use getAllPlatforms to add all platforms supported bu this plugin.
reqPlatforms
- Platforms to add.Add one or more platforms to support for providers. Use getAllPlatforms to add all platforms supported bu this plugin.
reqPlatforms
- Platforms to add.If the version is set via a version string return that, otherwise run terraform and parse the output
Use this to configure a system path search for Terraform
.
Replace current environment with new one. If this is called on the task extension, no project extension environment will be used.
args
- New environment key-value map of properties.Set an alternative local directory to look for provider packages rather than in upstream registries.
path
- Local path.Set an alternative network mirror service for provide packages.
uri
- Mirror location.Turn checkpoint warning on or off
value
- true
to warn on new terraform
versions.Converts a file path to a format suitable for interpretation by Terraform on the appropriate platform.
file
- Object that can be converted using project.file
.Adds AWS environmental variables to Terraform runtime environment.
org.ysb33r.terraform.aws
plugin instead and fine control AWS authentication in the
source sets.Turn checkpoint warning on or off
value
- true
to warn on new terraform
versions.Groovy Documentation