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

use of `run_on_server` and `features` produce a drift in the plan

Open oirtemed opened this issue 3 years ago • 2 comments

Describe the bug I've tried to replace the property Octopus.Action.RunOnServer with the argument run_on_server after getting the warning below.

╷
│ Warning: "Octopus.Action.RunOnServer" is defined in properties
│ 
│   with octopusdeploy_deployment_process.my_app,
│   on my-app.tf line 128, in resource "octopusdeploy_deployment_process" "my_app":
│  128:         "Octopus.Action.RunOnServer"                                                = "False"
│ 
│ Please update your template to specify "run_on_server" under the action
│ instead.
│ 
│ (and one more similar warning elsewhere)
╵

In a similar way I replaced the Octopus.Action.EnabledFeatures property with the features argument.

After making the changes on the configuration I get a permanent change in the plan (see below).

Steps to reproduce

  1. Create octopusdeploy_deployment_process resource with a step to run a PS script
resource "octopusdeploy_deployment_process" "my_app" {
  project_id = octopusdeploy_project.my_app.id

  step {
    condition           = "Success"
    name                = "StatusCheck"
    package_requirement = "LetOctopusDecide"
    properties = {
      "Octopus.Action.MaxParallelism" = "1"
      "Octopus.Action.TargetRoles"    = "my-app"
    }
    start_trigger = "StartAfterPrevious"
    target_roles = [
      "my-app",
    ]
    window_size = "1"

    run_script_action {
      condition = "Success"
      environments = [
        octopusdeploy_environment.dev.id,
      ]
      features = [
        "Octopus.Features.SubstituteInFiles",
      ]
      is_disabled = false
      is_required = true
      name        = "HTTP - Status check"
      notes       = "check status after deployment"
      properties = {
        "Octopus.Action.Script.ScriptBody"         = file("${path.module}/test_url.ps1")
        "Octopus.Action.Script.ScriptSource"       = "Inline"
        "Octopus.Action.Script.Syntax"             = "PowerShell"
      }
      run_on_server = false
      script_body   = file("${path.module}/test_url.ps1")
      script_source = "Inline"
      script_syntax = "PowerShell"
    }
  }
}
  1. run terraform apply
  2. run terraform plan without making any change in the configuration. This produces the plan output you can find below

Expected behavior Replacing the properties with the arguments should produce a clean plan after applying the change.

Logs and other supporting information terraform plan output after replacing the properties with arguments

      ~ step {
            id                  = "xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx"
            name                = "StatusCheck"
            # (6 unchanged attributes hidden)

          ~ run_script_action {
                id                                 = "xxxxxxxx-yyyy-xxxx-yyyy-xxxxxxxxxxxx"
                name                               = "HTTP - Status check"
              ~ properties                         = {
                  - "Octopus.Action.EnabledFeatures"           = "Octopus.Features.SubstituteInFiles" -> null
                  - "Octopus.Action.RunOnServer"               = "False" -> null
                    # (10 unchanged elements hidden)
                }
                # (13 unchanged attributes hidden)

                # (1 unchanged block hidden)
            }
        }

Environment and versions:

  • OS: Linux
  • Octopus Server Version: 2021.3 (Build 8275) (Octopus Deploy Cloud)
  • Terraform Version: 1.0.6
  • Octopus Terraform Provider Version: 0.7.68

oirtemed avatar Jan 25 '22 13:01 oirtemed

Related to https://github.com/OctopusDeployLabs/terraform-provider-octopusdeploy/issues/641

benPearce1 avatar Jul 18 '24 00:07 benPearce1

related to #297

domenicsim1 avatar Oct 16 '24 23:10 domenicsim1

This has been resolved in the new process resource released as part of v1.0 of the provider.

On 1 June 2025, the Octopus Deploy Terraform Provider was promoted from a Labs project to a fully-supported, first-class Octopus Deploy integration.

As part of this promotion, we released v1.0 of the provider, and migrated the codebase from the OctopusDeployLabs GitHub organization to the OctopusDeploy organization. The provider also moved in the Hashicorp Terraform Registry.

New Repository: https://github.com/OctopusDeploy/ New Provider Registry Page: https://registry.terraform.io/providers/OctopusDeploy/octopusdeploy/latest/docs Migration Guide: https://registry.terraform.io/providers/OctopusDeploy/octopusdeploy/1.0.0/docs/guides/moving-from-octopus-deploy-labs-namespace We are no longer accepting contributions or issues in this repo, and we plan to archive it.

Please head over to the new repository for continued support, updates and contributions.

domenicsim1 avatar Jun 04 '25 02:06 domenicsim1