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

Add ability to consume Step Templates in Deployment Processes

Open Shanjohn opened this issue 3 years ago • 12 comments

Is there a plan to support usage of step templates in octopusdeploy_deployment_process in the future?

Shanjohn avatar Mar 02 '21 17:03 Shanjohn

I managed to get something working via a standard step action:

  step {
    name      = "Terraform - PlanV2"
    condition = "Success"
    start_trigger = "StartAfterPrevious"
    action {
      action_type                        = "Octopus.TerraformPlan"
      can_be_used_for_project_versioning = true
      is_disabled = false
      is_required = true
      name        = "Terraform - PlanV2"
      properties = {
        "Octopus.Action.Package.DownloadOnTentacle"             = "False"
        "Octopus.Action.Package.FeedId"                         = "feeds-builtin"
        "Octopus.Action.Package.PackageId"                      = "#{Octopus.Project.Name}"
        "Octopus.Action.Script.ScriptSource"                    = "Package"
        "Octopus.Action.Template.Id"                            = "ActionTemplates-123"
        "Octopus.Action.Template.Version"                       = "3"

Found it useful to import from existing projects to get a working solution:

  • Create a sample project in OD
  • add the step processes you want
  • create a local terraform project and add a octopusdeploy_deployment_process resource, don't worry about the step details
  • run a terraform import <RESOURCE-ADDRESS> <OD-ID>
  • run a plan and it will show the differences which is effectively the data you want to grab or you can go through the statefile for details

From that information you can build you terraform code to suit the step template and clear out your temporary bits. May not be the long term best solution but for now it means we can proceed with deploying our OD build processes using step templates.

ray-jam avatar Mar 08 '21 15:03 ray-jam

The octopusdeploy_deployment_process resource has support for step lists. An example has been included in the documentation found in the Terraform Registry.

Is there something missing?

jbristowe avatar Mar 16 '21 09:03 jbristowe

@jbristowe It is completely ok for usual steps, but what about step templates ? When you use it, the right solution seems to be just to pass step template parameters as we do in GUI, but here we need to basically copy all of internal step template insides via properties manually

Shanjohn avatar Mar 25 '21 18:03 Shanjohn

I'm unclear on if using library step templates within the deployment process is actually supported. I raised issue #184 because I can't seem to import a deployment process that uses a library step template.

Additionally, I can't seem to create a new deployment resource using a library step template without specifying all the properties of the library step template directly, which defeats the purpose, as @Shanjohn mentioned above.

@jbristowe can you provide some clarity on if this pattern is supported for the octopusdeploy_deployment_process resource?

blytheaw avatar Apr 23 '21 18:04 blytheaw

The properties can be attached by including add them in the properties object in the deploy_package_action

I just raised a ticket #196 (which most likely can be linked to this) as this object has been flagged to be deprecated and its seems like a workaround

an example of this workaround is in there

angusmcdonald avatar Jun 10 '21 23:06 angusmcdonald

I am also facing the same issue. We can't use step template without defining the content of the step template.

chathsuom avatar Oct 01 '21 03:10 chathsuom

any update on this. I also get this warning in v0.8.1 "Warning: Argument is deprecated │ │ with module.project.octopusdeploy_deployment_process.main, │ on ....\modules\project\process.tf line 24, in resource "octopusdeploy_deployment_process" "main": │ 24: properties = {

seems like the work around for using properties to reference step templates. may be impacted by this in a coming release? hopefully, there are plans for a step_template resources and data blocks?

waylew50 avatar Sep 01 '22 13:09 waylew50

I'm really hoping for progress on this, being able to keep step templates in sync across spaces would be a big help!

We currently have around 100 deployments which are identical over 5 spaces, would be nice to be able to keep the same deployment processes the same.

lee5i3 avatar Apr 10 '23 20:04 lee5i3

Another user seeing this issue (internal) - https://octopus.zendesk.com/agent/tickets/172218

Clare-Octopus avatar Mar 04 '24 11:03 Clare-Octopus

Another affected user [Internal Link]

donnybell avatar Apr 15 '24 18:04 donnybell

Just want to chime in that this is an issue for us as well, and working around it makes our code become really messy. It would be great if it got some traction.

haraldsk avatar Jun 06 '24 13:06 haraldsk