Skip to content

Latest commit

 

History

History
109 lines (90 loc) · 3.91 KB

powershell_script_task.md

File metadata and controls

109 lines (90 loc) · 3.91 KB
page_title subcategory description
morpheus_powershell_script_task Resource - terraform-provider-morpheus
Provides a Morpheus powershell script task resource

morpheus_powershell_script_task

Provides a Morpheus powershell script task resource

Example Usage

Creating the powershell script task with local script content:

resource "morpheus_powershell_script_task" "tfexample_powershell_local" {
  name                = "tfexample_powershell_local"
  code                = "tfexample_powershell_local"
  labels              = ["demo", "terraform"]
  source_type         = "local"
  script_content      = <<EOF
  Write-Output "testing"
EOF
  elevated_shell      = true
  retryable           = true
  retry_count         = 1
  retry_delay_seconds = 10
  allow_custom_config = true
}

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

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

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

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

Schema

Required

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

Optional

  • allow_custom_config (Boolean) Custom configuration data to pass during the execution of the shell script
  • code (String) The code of the powershell script task
  • elevated_shell (Boolean) Run the powershell script with elevated permissions
  • execute_target (String) The execute target for the powershell script (local, remote or resource)
  • labels (Set of String) The organization labels associated with the task (Only supported on Morpheus 5.5.3 or higher)
  • remote_target_host (String) The hostname or ip address of the remote target
  • remote_target_password (String) The password of the user account used to authenticate to the remote target
  • remote_target_port (String) The port used to connect to the remote target
  • remote_target_username (String) The username of the user account used to authenticate to the remote target
  • repository_id (Number) The ID of the git repository integration
  • result_type (String) The expected result type (value, keyValue, 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 powershell script. Used when the local source type is specified
  • script_path (String) The path of the powershell 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 powershell script task

Import

Import is supported using the following syntax:

terraform import morpheus_powershell_script_task.tf_example_powershell_task_script 1