terraform-provider-octopusdeploy icon indicating copy to clipboard operation
terraform-provider-octopusdeploy copied to clipboard

[Feature] action_templates to be able to create/update Step Templates

Open lee5i3 opened this issue 1 year ago • 4 comments

We want to be able to use the same step template across spaces and we'd like to be able to manage this through terraform, we can currently do this with a bash script

Using CURL

curl -X POST "http://your-octopus-server/api/actiontemplates" \
     -H "X-Octopus-ApiKey: YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
            "Name": "My Custom Step",
            "Description": "This is a custom step for deploying a specific component",
            "ActionType": "Octopus.Script",
            "Version": 0,
            "Properties": {
                "Octopus.Action.Script.Syntax": "PowerShell",
                "Octopus.Action.Script.ScriptBody": "Write-Host \"Hello from my custom step!\""
            },
            "Parameters": [
                {
                    "Name": "Parameter1",
                    "Label": "My First Parameter",
                    "HelpText": "This is a parameter used by the custom step.",
                    "DefaultValue": "",
                    "DisplaySettings": {
                        "Octopus.ControlType": "SingleLineText"
                    }
                }
            ]
         }'

We'd like to be able to do something like this

resource "octopusdeploy_action_template" "my_custom_step" {
  name        = "My Custom Step"
  description = "This is a custom step for deploying a specific component"
  space_id = "Space-1"
  action_type = "Octopus.Script"
  properties {
    syntax = "PowerShell"
    script_body = "Write-Host Hello"
  }

  parameter {
      name = "Parameter1"
      label = "My Parameter"
      default_value = ""
  }
}

lee5i3 avatar Dec 13 '23 20:12 lee5i3

+1 this is something my team has been needing for a while.

garkenxian avatar Dec 19 '23 16:12 garkenxian

for the time being I am using the restapi terraform module. You can see a working example POC i created to help you through.

https://github.com/kennethgarza/terraform-script-module-null-resource-poc

garkenxian avatar Dec 19 '23 18:12 garkenxian

+1

andrew22224 avatar Jan 03 '24 22:01 andrew22224