Import Templates

Templates can become big over time while adding steps to execute additional business logic.

Example before template import:

- type: "terraformPlan"
  step: 100
    - runtime: "GROOVY"
      priority: 100
      before: true
      script: |
        import TerraTag
        new TerraTag().loadTool(
        "Terratag download completed"
    - runtime: "BASH"
      priority: 200
      before: true
      script: |
        cd $workingDirectory
        terratag -tags="{\"environment_id\": \"development\"}"
- type: "terraformApply"
  step: 300

Terrakube supports having the template logic in an external git repository like the following:

This feature is only available from Terrakube 2.11.0

  - type: "terraformPlan"
    step: 100
      repository: ""
      folder: "templates/terratag"
      branch: "import-template"
  - type: "terraformApply"
    step: 200

Using import templates become simply and we can reuse the logic accross several Terrakube organizations

The sample template can be found here.

The import commands are using a public repository, we will add support for private repositories in the future.

Last updated