Bootstrap

These plugins are available from the plugin portal. Add the appropriate plugin identifiers to your build.gradle file depending on the type of functionality you require.

build.gradle
plugins {
    id 'org.ysb33r.iac.base' version '2.0.0-alpha.5'  (1)

    id 'org.ysb33r.terraform.base' version '2.0.0-alpha.5'  (2)
    id 'org.ysb33r.terraform' version '2.0.0-alpha.5'  (3)
    id 'org.ysb33r.terraform.rc'  version '2.0.0-alpha.5'  (4)
    id 'org.ysb33r.terraform.wrapper'  version '2.0.0-alpha.5'  (5)

    id 'org.ysb33r.opentofu.base' version '2.0.0-alpha.5'  (6)
    id 'org.ysb33r.opentofu' version '2.0.0-alpha.5'  (7)
    id 'org.ysb33r.opentofu.rc'  version '2.0.0-alpha.5'  (8)
    id 'org.ysb33r.opentofu.wrapper'  version '2.0.0-alpha.5'  (9)

    id 'org.ysb33r.iac.aws.assumerole'  version '2.0.0-alpha.5'  (10)
}
1 A base plugin primarily used by Terraform, Packer and OpenTofu. It is not normally applied directly.
2 Provides Terraform extension and tasks.
3 Provides Terraform conventions, source sets and predefined tasks. This is the plugin that is normally used.
4 In a single project, this is automatically applied when applying org.ysb33r.terraform.base or org.ysb33r.terraform. In a multi-project, this needs to applied to the root project, is any of the subprojects applies a Terraform plugin.
5 This can be applied to the root project in order to create a terraform wrapper.
6 Provides OpenTofu extension and tasks.
7 Provides OpenTofu conventions, source sets and predefined tasks. This is the plugin that is normally used.
8 In a single project, this is automatically applied when applying org.ysb33r.opentofu.base or org.ysb33r.opentofu. In a multi-project, this needs to applied to the root project, is any of the subprojects applies an OpenTofu plugin.
9 This can be applied to the root project in order to create a tofu wrapper.
10 Allows AWS Support Role authentication to be performed within a a Gradle build.

Terraform plugin suite

The base plugin (org.ysb33r.terraform.base) provides:

  • A project extension named terraform.

  • Various Terraform task types which tend to map the terraform command closely. For instance for the init command, the appropriate task type is called tfInit.

  • Ability to download and use terraform executables.

When the base plugin is applied to the root project it will automatically apply the org.ysb33r.terraform.rc plugin.

In addition, the Terraform conventions plugin (org.ysb33r.terraform) will apply the base plugin and then add some conventions, including the main source set with default directory src/tf/main. It will also add formatting for terraform sources and format checks as part of the check lifecycle task.

The org.ysb33r.terraform.rc plugin is only applied in the root project and deals specifically with the creation of a configuration file for use by Terraform within the project. In a single project, there is no need to apply it, but in a multi-project where subprojects utilise any plugins from the suite, it should be applied to the root project. See Terraform Global Configuration.

The org.ysb33r.terraform.wrapper can be applied to the root project to create a wrapper for a specific version of Terraform. It adds a terraformw extension for the configuration. Only one version can be configured. Its main purpose is to make the binary used by Gradle available on the command-line and also to be configured from an IDE such as IntelliJ IDEA. If your build utilises multiple versions of Terraform, you should configure the version that is used the most. Running the terraformWrapper task will create terraformw and terraformw.bat scripts.

OpenTofu plugin suite

The base plugin (org.ysb33r.opentofu.base) provides:

  • A project extension named opentofu.

  • Various Terraform task types which tend to map the tofu command closely. For instance for the init command, the appropriate task type is called tofuInit.

  • Ability to download and use tofu executables.

When the base plugin is applied to the root project it will automatically apply the org.ysb33r.opentofu.rc plugin.

In addition, the Terraform conventions plugin (org.ysb33r.opentofu) will apply the base plugin and then add some conventions, including the main source set with default directory src/tf/main. It will also add formatting for terraform sources and format checks as part of the check lifecycle task.

The org.ysb33r.opentofu.rc plugin is only applied in the root project and deals specifically with the creation of a configuration file for use by OpenTofu within the project. In a single project, there is no need to apply it, but in a multi-project where subprojects utilise any plugins from the suite, it should be applied to the root project. See OpenTofu Global Configuration.

The org.ysb33r.opentofu.wrapper can be applied to the root project to create a wrapper for a specific version of OpenTofu. It adds a tofuw extension for the configuration. Only one version can be configured. Its main purpose is to make the binary used by Gradle available on the command-line and also to be configured from an IDE such as IntelliJ IDEA. If your build utilises multiple versions of OpenTofu, you should configure the version that is used the most. Running the opentofuWrapper task will create tofuw and tofuw.bat scripts