Skip to content

Latest commit

 

History

History
100 lines (81 loc) · 3.17 KB

groovy_script_task.md

File metadata and controls

100 lines (81 loc) · 3.17 KB
page_title subcategory description
morpheus_groovy_script_task Resource - terraform-provider-morpheus
Provides a Morpheus groovy script task resource

morpheus_groovy_script_task

Provides a Morpheus groovy script task resource

Example Usage

Creating the groovy script task with local script content:

resource "morpheus_groovy_script_task" "tfexample_groovy_local" {
  name                = "tfexample_groovy_local"
  code                = "tfexample_groovy_local"
  labels              = ["demo", "terraform"]
  source_type         = "local"
  script_content      = <<EOF
println "hello"
EOF
  retryable           = true
  retry_count         = 1
  retry_delay_seconds = 10
  allow_custom_config = true
}

Creating the groovy script task with the script fetched from a url:

resource "morpheus_groovy_script_task" "tfexample_groovy_url" {
  name                = "tfexample_groovy_url"
  code                = "tfexample_groovy_url"
  labels              = ["demo", "terraform"]
  source_type         = "url"
  result_type         = "json"
  script_path         = "https://example.com/example.groovy"
  retryable           = true
  retry_count         = 1
  retry_delay_seconds = 10
  allow_custom_config = true
}

Creating the groovy script task with the script fetch via git:

resource "morpheus_groovy_script_task" "tfexample_groovy_git" {
  name                = "tfexample_groovy_git"
  code                = "tfexample_groovy_git"
  labels              = ["demo", "terraform"]
  source_type         = "repository"
  result_type         = "json"
  script_path         = "example.groovy"
  version_ref         = "master"
  repository_id       = 1
  retryable           = true
  retry_count         = 1
  retry_delay_seconds = 10
  allow_custom_config = true
}

Schema

Required

  • name (String) The name of the groovy script task
  • source_type (String) The source of the groovy script (local, url or repository)

Optional

  • allow_custom_config (Boolean) Custom configuration data to pass during the execution of the groovy script
  • code (String) The code of the groovy script task
  • labels (Set of String) The organization labels associated with the task (Only supported on Morpheus 5.5.3 or higher)
  • repository_id (Number) The ID of the git repository integration
  • result_type (String) The expected result type (single value, key pairs, json)
  • retry_count (Number) The number of times to retry the task if there is a failure
  • retry_delay_seconds (Number) The number of seconds to wait between retry attempts
  • retryable (Boolean) Whether to retry the task if there is a failure
  • script_content (String) The content of the groovy script. Used when the local source type is specified
  • script_path (String) The path of the groovy script, either the url or the path in the repository
  • version_ref (String) The git reference of the repository to pull (main, master, etc.)

Read-Only

  • id (String) The ID of the groovy script task

Import

Import is supported using the following syntax:

terraform import morpheus_groovy_script_task.tf_example_groovy_script 1