Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project tenant template variables save secrets as plain text #590

Open
mcasperson opened this issue Dec 22, 2023 · 0 comments
Open

Project tenant template variables save secrets as plain text #590

mcasperson opened this issue Dec 22, 2023 · 0 comments
Labels
category/dev-experience Issues about the dev experience of using the provider, writing correct HCL etc kind/bug Something isn't working

Comments

@mcasperson
Copy link
Contributor

mcasperson commented Dec 22, 2023

Describe the bug

The default_value of Test2 in the tenant project variable template example below is saved as plain text by the Octopus API, whereas it would be saved as a secret when defined via the UI:

resource "octopusdeploy_project" "deploy_frontend_project" {
  auto_create_release                  = false
  default_guided_failure_mode          = "EnvironmentDefault"
  default_to_skip_if_already_installed = false
  description                          = "Test project"
  discrete_channel_release             = false
  is_disabled                          = false
  is_discrete_channel_release          = false
  is_version_controlled                = false
  lifecycle_id                         = data.octopusdeploy_lifecycles.lifecycle_default_lifecycle.lifecycles[0].id
  name                                 = "Test"
  project_group_id                     = octopusdeploy_project_group.project_group_test.id
  tenanted_deployment_participation    = "Untenanted"
  space_id                             = var.octopus_space_id
  included_library_variable_sets       = []
  versioning_strategy {
    template = "#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.LastPatch}.#{Octopus.Version.NextRevision}"
  }

  connectivity_policy {
    allow_deployments_to_no_targets = false
    exclude_unhealthy_targets       = false
    skip_machine_behavior           = "SkipUnavailableMachines"
  }

  template {
    name             = "Project Template Variable"
    label            = "Test2"
    default_value    = "Test2"
    display_settings = { "Octopus.ControlType" = "Sensitive" }
  }
}

According to the docs, there is no other field for defining the default value of a sensitive tenant variable template:

[Nested Schema for template](https://registry.terraform.io/providers/OctopusDeployLabs/octopusdeploy/latest/docs/resources/project#nested-schema-for-template)

Required:

* name (String) The name of the variable set by the parameter. The name can contain letters, digits, dashes and periods. Example: ServerName.

Optional:

* default_value (String) A default value for the parameter, if applicable. This can be a hard-coded value or a variable reference.
* display_settings (Map of String) The display settings for the parameter.
* help_text (String) The help presented alongside the parameter input.
* id (String) The unique ID for this resource.
* label (String) The label shown beside the parameter when presented in the deployment process. Example: Server name.

Steps to reproduce

  1. Apply the sample terraform resource above
  2. Open the resulting project
  3. Notice that the default value for the sensitive variable is shown in plain text

Expected behavior
The sensitive value should be stored by the API as a secret, and not returned as plain text.

Screenshots

This is an example of a sensitive tenant variable template with a default value shown in plain text:

image
image

Environment and versions:

  • OS: Linux
  • Octopus Server Version: 2024.1
  • Terraform Version: 1.6
  • Octopus Terraform Provider Version: 0.14.3
@domenicsim1 domenicsim1 added kind/bug Something isn't working category/dev-experience Issues about the dev experience of using the provider, writing correct HCL etc labels Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category/dev-experience Issues about the dev experience of using the provider, writing correct HCL etc kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants