Skip to content

Comments

fix: set script module name on update#396

Merged
bec-callow-oct merged 1 commit intomainfrom
fnm/set-script-module-name
Feb 4, 2026
Merged

fix: set script module name on update#396
bec-callow-oct merged 1 commit intomainfrom
fnm/set-script-module-name

Conversation

@bec-callow-oct
Copy link
Contributor

@bec-callow-oct bec-callow-oct commented Feb 2, 2026

[SC-133845]

The Go Client fails to update script module names because the name is never mapped from incoming requests. This caused confusion for customers trying to modify their data via terraform.

Fixes: OctopusDeploy/Issues#9852

Before

Initial setup

image

After updating via terraform

The All Variables page shows the variable set with its original name, but variables with their new names

image

The Runbook Process page shows the updated module name

image

If usages of the script were updated with the new name, execution fails

image

If usages of the script were not updated with the new name, execution succeeds and logs reference the script module using the old name

image

After

Initial setup

image

After updating via terraform

The All Variables page only shows the new name

image

The Runbook Process page shows the updated module name

image

If usages of the script were updated with the new name, execution succeeds

image

If usages of the script were not updated with the new name, execution fails

image

Sample terraform config for testing

terraform {
  required_providers {
    octopusdeploy = {
      source = "octopus.com/com/octopusdeploy"
      version = "1.2.603" # change to local build version
    }
  }
}

provider "octopusdeploy" {
  address   = "<Octopus URL>"
  api_key   = "<API-Key>"
  space_id  = "Spaces-1"
}

data "octopusdeploy_lifecycles" "default" {
  partial_name = "Default Lifecycle"
}

data "octopusdeploy_project_groups" "default" {
  partial_name = "Default Project Group"
}

resource "octopusdeploy_script_module" "hello_world_bash_module" {
  name        = "Hello World Bash Script Module" # Rename to test updates

  script {
    syntax = "Bash"
    body   = <<-EOT
function say_hello() {
  echo "Hello World!"
}
    EOT
  }
}

resource "octopusdeploy_project" "hello_world_project" {
  name             = "Hello World Script Module Project"
  lifecycle_id     = data.octopusdeploy_lifecycles.default.lifecycles[0].id
  project_group_id = data.octopusdeploy_project_groups.default.project_groups[0].id

  included_library_variable_sets = [
    octopusdeploy_script_module.hello_world_bash_module.id
  ]

  connectivity_policy {
    allow_deployments_to_no_targets = true
    skip_machine_behavior            = "None"
  }

  depends_on = [
    octopusdeploy_script_module.hello_world_bash_module
  ]
}

resource "octopusdeploy_runbook" "test_script_module_runbook" {
  project_id          = octopusdeploy_project.hello_world_project.id
  name                = "Test Script Module"
  multi_tenancy_mode  = "Untenanted"
  connectivity_policy {
    allow_deployments_to_no_targets = true
    skip_machine_behavior           = "None"
  }
}

resource "octopusdeploy_process" "test_script_module_process" {
  project_id = octopusdeploy_project.hello_world_project.id
  runbook_id = octopusdeploy_runbook.test_script_module_runbook.id
}

resource "octopusdeploy_process_step" "hello_world_script_step" {
  process_id = octopusdeploy_process.test_script_module_process.id
  name       = "Hello World Script"
  type       = "Octopus.Script"

  execution_properties = {
    "Octopus.Action.RunOnServer"         = "True"
    "Octopus.Action.Script.ScriptSource" = "Inline"
    "Octopus.Action.Script.Syntax"       = "Bash"
    # Update to match the name of the script module wihout spaces
    "Octopus.Action.Script.ScriptBody"   = <<-EOT
      #!/bin/bash
      source HelloWorldBashScriptModule.sh
      say_hello
    EOT
  }

  is_disabled = false
  is_required = true
}

@bec-callow-oct bec-callow-oct marked this pull request as ready for review February 3, 2026 00:36
@bec-callow-oct bec-callow-oct requested a review from a team February 3, 2026 00:57
Copy link
Contributor

@benPearce1 benPearce1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested successfully locally

@bec-callow-oct bec-callow-oct merged commit e5d762b into main Feb 4, 2026
6 of 9 checks passed
@bec-callow-oct bec-callow-oct deleted the fnm/set-script-module-name branch February 4, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terraform Provider - Modifying Script Module Name Doesn't Update Name In Reference Variables

2 participants