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

Error: This deployment step does not support named package references

Open pemaxim opened this issue 3 years ago • 2 comments

Describe the bug

Deployment Process - Action type Octopus.IIS.

On terraform apply the following error occurs for process step action type Octopus.IIS ("Deploy to IIS" community step template):

Error: octopus deploy api returned an error on endpoint /api/Spaces-297/deploymentprocesses/deploymentprocess-Projects-2974 - [This deployment step does not support named package references]

The code example:

resource "octopusdeploy_deployment_process" "my_project" {

  project_id = octopusdeploy_project.my_project.id

  step {
    name          = "Deploy to IIS - Application"
    start_trigger = "StartAfterPrevious"

    target_roles = ["pg"]

    action {

      name        = "Deploy to IIS - Application"
      action_type = "Octopus.IIS"

      is_disabled = false
      is_required = false

      package {
        name                      = "scps-build-5"
        package_id                = "scps-build-5"
        feed_id                   = lookup(local.feeds.builtin, "Id")
        acquisition_location      = "Server"
        extract_during_deployment = true

        properties = {
          "Extract": "true",
          "SelectionMode" = "immediate"
        }

      }

      properties = {
        "Octopus.Action.IISWebSite.DeploymentType"                                         = "webApplication"
        "Octopus.Action.IISWebSite.CreateOrUpdateWebSite"                                  = "False"
        "Octopus.Action.IISWebSite.Bindings"                                               = "[{\"protocol\":\"http\",\"port\":\"80\",\"host\":\"\",\"thumbprint\":null,\"certificateVariable\":null,\"requireSni\":\"False\",\"enabled\":\"True\"}]"
        "Octopus.Action.IISWebSite.ApplicationPoolFrameworkVersion"                        = "v4.0"
        "Octopus.Action.IISWebSite.ApplicationPoolIdentityType"                            = "ApplicationPoolIdentity"
        "Octopus.Action.IISWebSite.EnableAnonymousAuthentication"                          = "False"
        "Octopus.Action.IISWebSite.EnableBasicAuthentication"                              = "False"
        "Octopus.Action.IISWebSite.EnableWindowsAuthentication"                            = "True"
        "Octopus.Action.IISWebSite.WebApplication.ApplicationPoolFrameworkVersion"         = "v4.0"
        "Octopus.Action.IISWebSite.WebApplication.ApplicationPoolIdentityType"             = "ApplicationPoolIdentity"
        "Octopus.Action.IISWebSite.WebRootType"                                            = "packageRoot"
        "Octopus.Action.IISWebSite.StartApplicationPool"                                   = "True"
        "Octopus.Action.IISWebSite.StartWebSite"                                           = "True"
        "Octopus.Action.IISWebSite.VirtualDirectory.CreateOrUpdate"                        = "False"
        "Octopus.Action.IISWebSite.WebApplication.CreateOrUpdate"                          = "True"
        "Octopus.Action.IISWebSite.WebApplication.WebSiteName"                             = "PaymentWebsite"
        "Octopus.Action.IISWebSite.WebApplication.VirtualPath"                             = "/PaymentWebServer"
        "Octopus.Action.IISWebSite.WebApplication.ApplicationPoolName"                     = "PaymentWebsite"
        "Octopus.Action.WebApplication.WebRootType"                                        = "packageRoot"
        "Octopus.Action.EnabledFeatures"                                                   = "Octopus.Features.IISWebSite,Octopus.Features.CustomDirectory,Octopus.Features.ConfigurationVariables,Octopus.Features.ConfigurationTransforms"
        "Octopus.Action.Package.CustomInstallationDirectory"                               = "c:\\Program Files (x86)\\Sequoia Retail Systems\\PaymentWebsite\\PaymentWebServer"
        "Octopus.Action.Package.CustomInstallationDirectoryShouldBePurgedBeforeDeployment" = "True"
        "Octopus.Action.Package.AutomaticallyRunConfigurationTransformationFiles"          = "True"
        "Octopus.Action.Package.AutomaticallyUpdateAppSettingsAndConnectionStrings"        = "True"
        "Octopus.Action.Package.PackageId"                                                 = "scps-build-5"
        "Octopus.Action.Package.FeedId"                                                    = lookup(local.feeds.builtin, "Id")
        "Octopus.Action.Package.DownloadOnTentacle"                                        = "False"
      }

    }

  }

}

Logs and other supporting information

  # octopusdeploy_deployment_process.scps-v1 will be created
  + resource "octopusdeploy_deployment_process" "my_project" {

      + id         = (known after apply)
      + project_id = "Projects-2974"
      + space_id   = (known after apply)
      + version    = (known after apply)

      + step {
          + condition            = "Success"
          + condition_expression = (known after apply)
          + id                   = (known after apply)
          + name                 = "Deploy to IIS - Application"
          + package_requirement  = "LetOctopusDecide"
          + properties           = (known after apply)
          + start_trigger        = "StartAfterPrevious"
          + target_roles         = [
              + "pg",
            ]

          + action {
              + action_type                        = "Octopus.IIS"
              + can_be_used_for_project_versioning = (known after apply)
              + channels                           = (known after apply)
              + condition                          = (known after apply)
              + environments                       = (known after apply)
              + excluded_environments              = [
                  + "Environments-3307",
                  + "Environments-3310",
                ]
              + id                                 = (known after apply)
              + is_disabled                        = false
              + is_required                        = false
              + name                               = "Deploy to IIS - Application"
              + properties                         = {
                  + "Octopus.Action.EnabledFeatures"                                                   = "Octopus.Features.IISWebSite,Octopus.Features.CustomDirectory,Octopus.Features.ConfigurationVariables,Octopus.Features.ConfigurationTransforms"
                  + "Octopus.Action.IISWebSite.ApplicationPoolFrameworkVersion"                        = "v4.0"
                  + "Octopus.Action.IISWebSite.ApplicationPoolIdentityType"                            = "ApplicationPoolIdentity"
                  + "Octopus.Action.IISWebSite.Bindings"                                               = jsonencode(
                        [
                          + {
                              + certificateVariable = null
                              + enabled             = "True"
                              + host                = ""
                              + port                = "80"
                              + protocol            = "http"
                              + requireSni          = "False"
                              + thumbprint          = null
                            },
                        ]
                    )
                  + "Octopus.Action.IISWebSite.CreateOrUpdateWebSite"                                  = "False"
                  + "Octopus.Action.IISWebSite.DeploymentType"                                         = "webApplication"
                  + "Octopus.Action.IISWebSite.EnableAnonymousAuthentication"                          = "False"
                  + "Octopus.Action.IISWebSite.EnableBasicAuthentication"                              = "False"
                  + "Octopus.Action.IISWebSite.EnableWindowsAuthentication"                            = "True"
                  + "Octopus.Action.IISWebSite.StartApplicationPool"                                   = "True"
                  + "Octopus.Action.IISWebSite.StartWebSite"                                           = "True"
                  + "Octopus.Action.IISWebSite.VirtualDirectory.CreateOrUpdate"                        = "False"
                  + "Octopus.Action.IISWebSite.WebApplication.ApplicationPoolFrameworkVersion"         = "v4.0"
                  + "Octopus.Action.IISWebSite.WebApplication.ApplicationPoolIdentityType"             = "ApplicationPoolIdentity"
                  + "Octopus.Action.IISWebSite.WebApplication.ApplicationPoolName"                     = "PaymentWebsite"
                  + "Octopus.Action.IISWebSite.WebApplication.CreateOrUpdate"                          = "True"
                  + "Octopus.Action.IISWebSite.WebApplication.VirtualPath"                             = "/PaymentWebServer"
                  + "Octopus.Action.IISWebSite.WebApplication.WebSiteName"                             = "PaymentWebsite"
                  + "Octopus.Action.IISWebSite.WebRootType"                                            = "packageRoot"
                  + "Octopus.Action.Package.AutomaticallyRunConfigurationTransformationFiles"          = "True"
                  + "Octopus.Action.Package.AutomaticallyUpdateAppSettingsAndConnectionStrings"        = "True"
                  + "Octopus.Action.Package.CustomInstallationDirectory"                               = "c:\\Program Files (x86)\\Sequoia Retail Systems\\PaymentWebsite\\PaymentWebServer"
                  + "Octopus.Action.Package.CustomInstallationDirectoryShouldBePurgedBeforeDeployment" = "True"
                  + "Octopus.Action.Package.DownloadOnTentacle"                                        = "False"
                  + "Octopus.Action.Package.FeedId"                                                    = "Feeds-2520"
                  + "Octopus.Action.Package.PackageId"                                                 = "scps-build-5"
                  + "Octopus.Action.WebApplication.WebRootType"                                        = "packageRoot"
                }
              + run_on_server                      = false
              + tenant_tags                        = (known after apply)

              + container {
                  + feed_id = (known after apply)
                  + image   = (known after apply)
                }

              + package {
                  + acquisition_location      = "Server"
                  + extract_during_deployment = true
                  + feed_id                   = "Feeds-2520"
                  + id                        = (known after apply)
                  + name                      = "scps-build-5"
                  + package_id                = "scps-build-5"
                  + properties                = {
                      + "Extract"       = "true"
                      + "SelectionMode" = "immediate"
                    }
                }

              + primary_package {
                  + acquisition_location = (known after apply)
                  + feed_id              = (known after apply)
                  + id                   = (known after apply)
                  + name                 = (known after apply)
                  + package_id           = (known after apply)
                  + properties           = (known after apply)
                }
            }

          + apply_terraform_action {
              + additional_init_params             = (known after apply)
              + allow_plugin_downloads             = (known after apply)
              + can_be_used_for_project_versioning = (known after apply)
              + channels                           = (known after apply)
              + condition                          = (known after apply)
              + environments                       = (known after apply)
              + excluded_environments              = (known after apply)
              + id                                 = (known after apply)
              + is_disabled                        = (known after apply)
              + is_required                        = (known after apply)
              + managed_account                    = (known after apply)
              + name                               = (known after apply)
              + notes                              = (known after apply)
              + properties                         = (known after apply)
              + run_on_server                      = (known after apply)
              + tenant_tags                        = (known after apply)

              + container {
                  + feed_id = (known after apply)
                  + image   = (known after apply)
                }

              + package {
                  + acquisition_location = (known after apply)
                  + feed_id              = (known after apply)
                  + id                   = (known after apply)
                  + name                 = (known after apply)
                  + package_id           = (known after apply)
                  + properties           = (known after apply)
                }

              + primary_package {
                  + acquisition_location = (known after apply)
                  + feed_id              = (known after apply)
                  + id                   = (known after apply)
                  + name                 = (known after apply)
                  + package_id           = (known after apply)
                  + properties           = (known after apply)
                }
            }

          + deploy_kubernetes_secret_action {
              + can_be_used_for_project_versioning = (known after apply)
              + channels                           = (known after apply)
              + condition                          = (known after apply)
              + environments                       = (known after apply)
              + excluded_environments              = (known after apply)
              + id                                 = (known after apply)
              + is_disabled                        = (known after apply)
              + is_required                        = (known after apply)
              + name                               = (known after apply)
              + notes                              = (known after apply)
              + properties                         = (known after apply)
              + run_on_server                      = (known after apply)
              + secret_name                        = (known after apply)
              + tenant_tags                        = (known after apply)

              + container {
                  + feed_id = (known after apply)
                  + image   = (known after apply)
                }

              + package {
                  + acquisition_location = (known after apply)
                  + feed_id              = (known after apply)
                  + id                   = (known after apply)
                  + name                 = (known after apply)
                  + package_id           = (known after apply)
                  + properties           = (known after apply)
                }

              + secret_values {
                  + key   = (known after apply)
                  + value = (known after apply)
                }
            }

          + deploy_package_action {
              + can_be_used_for_project_versioning = (known after apply)
              + channels                           = (known after apply)
              + condition                          = (known after apply)
              + environments                       = (known after apply)
              + excluded_environments              = (known after apply)
              + id                                 = (known after apply)
              + is_disabled                        = (known after apply)
              + is_required                        = (known after apply)
              + name                               = (known after apply)
              + notes                              = (known after apply)
              + properties                         = (known after apply)
              + tenant_tags                        = (known after apply)

              + container {
                  + feed_id = (known after apply)
                  + image   = (known after apply)
                }

              + package {
                  + acquisition_location = (known after apply)
                  + feed_id              = (known after apply)
                  + id                   = (known after apply)
                  + name                 = (known after apply)
                  + package_id           = (known after apply)
                  + properties           = (known after apply)
                }

              + primary_package {
                  + acquisition_location = (known after apply)
                  + feed_id              = (known after apply)
                  + id                   = (known after apply)
                  + name                 = (known after apply)
                  + package_id           = (known after apply)
                  + properties           = (known after apply)
                }

              + windows_service {
                  + arguments                = (known after apply)
                  + create_or_update_service = (known after apply)
                  + custom_account_name      = (known after apply)
                  + custom_account_password  = (sensitive value)
                  + dependencies             = (known after apply)
                  + description              = (known after apply)
                  + display_name             = (known after apply)
                  + executable_path          = (known after apply)
                  + service_account          = (known after apply)
                  + service_name             = (known after apply)
                  + start_mode               = (known after apply)
                }
            }

          + deploy_windows_service_action {
              + arguments                          = (known after apply)
              + can_be_used_for_project_versioning = (known after apply)
              + channels                           = (known after apply)
              + condition                          = (known after apply)
              + create_or_update_service           = (known after apply)
              + custom_account_name                = (known after apply)
              + custom_account_password            = (sensitive value)
              + dependencies                       = (known after apply)
              + description                        = (known after apply)
              + display_name                       = (known after apply)
              + environments                       = (known after apply)
              + excluded_environments              = (known after apply)
              + executable_path                    = (known after apply)
              + id                                 = (known after apply)
              + is_disabled                        = (known after apply)
              + is_required                        = (known after apply)
              + name                               = (known after apply)
              + notes                              = (known after apply)
              + properties                         = (known after apply)
              + service_account                    = (known after apply)
              + service_name                       = (known after apply)
              + start_mode                         = (known after apply)
              + tenant_tags                        = (known after apply)

              + container {
                  + feed_id = (known after apply)
                  + image   = (known after apply)
                }

              + package {
                  + acquisition_location = (known after apply)
                  + feed_id              = (known after apply)
                  + id                   = (known after apply)
                  + name                 = (known after apply)
                  + package_id           = (known after apply)
                  + properties           = (known after apply)
                }

              + primary_package {
                  + acquisition_location = (known after apply)
                  + feed_id              = (known after apply)
                  + id                   = (known after apply)
                  + name                 = (known after apply)
                  + package_id           = (known after apply)
                  + properties           = (known after apply)
                }
            }

          + manual_intervention_action {
              + can_be_used_for_project_versioning = (known after apply)
              + channels                           = (known after apply)
              + condition                          = (known after apply)
              + environments                       = (known after apply)
              + excluded_environments              = (known after apply)
              + id                                 = (known after apply)
              + instructions                       = (known after apply)
              + is_disabled                        = (known after apply)
              + is_required                        = (known after apply)
              + name                               = (known after apply)
              + notes                              = (known after apply)
              + properties                         = (known after apply)
              + responsible_teams                  = (known after apply)
              + tenant_tags                        = (known after apply)

              + container {
                  + feed_id = (known after apply)
                  + image   = (known after apply)
                }

              + package {
                  + acquisition_location = (known after apply)
                  + feed_id              = (known after apply)
                  + id                   = (known after apply)
                  + name                 = (known after apply)
                  + package_id           = (known after apply)
                  + properties           = (known after apply)
                }
            }

          + run_kubectl_script_action {
              + can_be_used_for_project_versioning = (known after apply)
              + channels                           = (known after apply)
              + condition                          = (known after apply)
              + environments                       = (known after apply)
              + excluded_environments              = (known after apply)
              + id                                 = (known after apply)
              + is_disabled                        = (known after apply)
              + is_required                        = (known after apply)
              + name                               = (known after apply)
              + notes                              = (known after apply)
              + properties                         = (known after apply)
              + run_on_server                      = (known after apply)
              + script_file_name                   = (known after apply)
              + script_parameters                  = (known after apply)
              + script_source                      = (known after apply)
              + tenant_tags                        = (known after apply)

              + container {
                  + feed_id = (known after apply)
                  + image   = (known after apply)
                }

              + package {
                  + acquisition_location      = (known after apply)
                  + extract_during_deployment = (known after apply)
                  + feed_id                   = (known after apply)
                  + id                        = (known after apply)
                  + name                      = (known after apply)
                  + package_id                = (known after apply)
                  + properties                = (known after apply)
                }

              + primary_package {
                  + acquisition_location = (known after apply)
                  + feed_id              = (known after apply)
                  + id                   = (known after apply)
                  + name                 = (known after apply)
                  + package_id           = (known after apply)
                  + properties           = (known after apply)
                }
            }

          + run_script_action {
              + can_be_used_for_project_versioning = (known after apply)
              + channels                           = (known after apply)
              + condition                          = (known after apply)
              + environments                       = (known after apply)
              + excluded_environments              = (known after apply)
              + id                                 = (known after apply)
              + is_disabled                        = (known after apply)
              + is_required                        = (known after apply)
              + name                               = (known after apply)
              + notes                              = (known after apply)
              + properties                         = (known after apply)
              + run_on_server                      = (known after apply)
              + script_body                        = (known after apply)
              + script_file_name                   = (known after apply)
              + script_parameters                  = (known after apply)
              + script_source                      = (known after apply)
              + script_syntax                      = (known after apply)
              + tenant_tags                        = (known after apply)
              + variable_substitution_in_files     = (known after apply)

              + container {
                  + feed_id = (known after apply)
                  + image   = (known after apply)
                }

              + package {
                  + acquisition_location      = (known after apply)
                  + extract_during_deployment = (known after apply)
                  + feed_id                   = (known after apply)
                  + id                        = (known after apply)
                  + name                      = (known after apply)
                  + package_id                = (known after apply)
                  + properties                = (known after apply)
                }

              + primary_package {
                  + acquisition_location = (known after apply)
                  + feed_id              = (known after apply)
                  + id                   = (known after apply)
                  + name                 = (known after apply)
                  + package_id           = (known after apply)
                  + properties           = (known after apply)
                }
            }
        }
    }

Environment and versions:

  • OS: Linux
  • Octopus Server Version: 2020.5.0
  • Terraform Version: 0.14.9
  • Octopus Terraform Provider Version: 0.7.16

pemaxim avatar Apr 08 '21 12:04 pemaxim

Hey @pemaxim! 👋 Thank you for submitting this issue. I'm sorry you're experiencing problems with this step.

The current workaround is to define your package as follows:

primary_package {
  acquisition_location = "Server"
  feed_id              = local.feed_id
  package_id           = "scps-build-5"

  properties = {
    "SelectionMode" = "immediate"
  }
}

This schema will likely change in the near future; we'll be adding a step for this deployment process that will have far better validation and no properties.

jbristowe avatar Apr 20 '21 12:04 jbristowe

Thanks @jbristowe for the solution. I will try it.

pemaxim avatar Apr 21 '21 15:04 pemaxim

Using the primary_package is the way forward.

I will close this issue.

johnsimons avatar Feb 22 '23 06:02 johnsimons