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

Deployment freeze support tenant scope #837

Merged
merged 11 commits into from
Dec 6, 2024

Conversation

HuyPhanNguyen
Copy link
Collaborator

Add ability to add tenant scope to a deployment freeze.

resource "octopusdeploy_deployment_freeze" "test_freeze" {
  name  = "Test Freeze"
  start = "2025-11-21T06:30:00+10:00"
  end   = "2026-11-21T08:30:00+10:00"
}

resource "octopusdeploy_deployment_freeze_tenant" "tenant_freeze" {
  deploymentfreeze_id = octopusdeploy_deployment_freeze.test_freeze.id
  tenant_id           = "Tenants-21"
  project_id          = "Projects-161"
  environment_id      = "Environments-82"

}

sc-99058

Create

Terraform will perform the following actions:

  # octopusdeploy_deployment_freeze.test_freeze will be created
  + resource "octopusdeploy_deployment_freeze" "test_freeze" {
      + end   = "2026-11-21T08:30:00+10:00"
      + id    = (known after apply)
      + name  = "Test Freeze"
      + start = "2025-11-21T06:30:00+10:00"
    }

  # octopusdeploy_deployment_freeze_tenant.tenant_freeze will be created
  + resource "octopusdeploy_deployment_freeze_tenant" "tenant_freeze" {
      + deploymentfreeze_id = (known after apply)
      + environment_id      = "Environments-82"
      + id                  = (known after apply)
      + project_id          = "Projects-161"
      + tenant_id           = "Tenants-21"
    }

Plan: 2 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

octopusdeploy_deployment_freeze.test_freeze: Creating...
octopusdeploy_deployment_freeze.test_freeze: Creation complete after 0s [id=DeploymentFreezes-766]
octopusdeploy_deployment_freeze_tenant.tenant_freeze: Creating...
octopusdeploy_deployment_freeze_tenant.tenant_freeze: Creation complete after 1s [id=DeploymentFreezes-766:Tenants-21:Projects-161:Environments-82]

image

Update

Terraform will perform the following actions:

  # octopusdeploy_deployment_freeze_tenant.tenant_freeze must be replaced
-/+ resource "octopusdeploy_deployment_freeze_tenant" "tenant_freeze" {
      ~ environment_id      = "Environments-82" -> "Environments-81" # forces replacement
      ~ id                  = "DeploymentFreezes-763:Tenants-21:Projects-161:Environments-82" -> (known after apply)
        # (3 unchanged attributes hidden)
    }

Plan: 1 to add, 0 to change, 1 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

octopusdeploy_deployment_freeze_tenant.tenant_freeze: Destroying... [id=DeploymentFreezes-763:Tenants-21:Projects-161:Environments-82]
octopusdeploy_deployment_freeze_tenant.tenant_freeze: Destruction complete after 0s
octopusdeploy_deployment_freeze_tenant.tenant_freeze: Creating...
octopusdeploy_deployment_freeze_tenant.tenant_freeze: Creation complete after 1s [id=DeploymentFreezes-763:Tenants-21:Projects-161:Environments-81]

Apply complete! Resources: 1 added, 0 changed, 1 destroyed.

image

Destroy

Terraform will perform the following actions:

  # octopusdeploy_deployment_freeze_tenant.tenant_freeze will be destroyed
  # (because octopusdeploy_deployment_freeze_tenant.tenant_freeze is not in configuration)
  - resource "octopusdeploy_deployment_freeze_tenant" "tenant_freeze" {
      - deploymentfreeze_id = "DeploymentFreezes-763" -> null
      - environment_id      = "Environments-81" -> null
      - id                  = "DeploymentFreezes-763:Tenants-21:Projects-161:Environments-81" -> null
      - project_id          = "Projects-161" -> null
      - tenant_id           = "Tenants-21" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

octopusdeploy_deployment_freeze_tenant.tenant_freeze: Destroying... [id=DeploymentFreezes-763:Tenants-21:Projects-161:Environments-81]
octopusdeploy_deployment_freeze_tenant.tenant_freeze: Destruction complete after 0s

Apply complete! Resources: 0 added, 0 changed, 1 destroyed.

image

@HuyPhanNguyen HuyPhanNguyen enabled auto-merge (squash) December 6, 2024 03:59
@HuyPhanNguyen HuyPhanNguyen enabled auto-merge (squash) December 6, 2024 03:59
@HuyPhanNguyen HuyPhanNguyen merged commit aff00bd into main Dec 6, 2024
22 checks passed
@HuyPhanNguyen HuyPhanNguyen deleted the huy/deployment-freeze-tenant branch December 6, 2024 04:43
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.

2 participants