terraform-provider-octopusdeploy
terraform-provider-octopusdeploy copied to clipboard
Ephemeral action ids are impossible to reference in `octopusdeploy_variable` action scopes
Describe the bug
Deployment steps get new ids whenever they're changed. This makes it impossible to target them in the octopusdeploy_variable.scope.actions
array if they change.
Steps to reproduce
- Add an
octopusdeploy_project
and aoctopusdeploy_deployment_process
resource with 2 deployment steps (doesn't matter which type). - Deploy the changes to Octopus
- Gather the IDs of your deployment steps by navigating to them in the Octopus UI (or via the API)
- Add an
octopusdeploy_variable
, reference theoctopusdeploy_project
with theowner_id
and limit the scope to a particular action:
resource "octopusdeploy_variable" "my_connection_string" {
name = "ConnectionStrings:DefaultConnection"
value = "..."
owner_id = octopusdeploy_project.my_project.id
type = "string"
scope {
actions = [
"42110fb4-6e4f-4bd3-b795-0743aa7ab5be" # The ID of the deployment step you want to target
]
}
}
- Deploy the changes to Octopus
- Make a change to your targeted deployment step via Terraform
- Deploy the changes to Octopus
- The ID you provided for the
scope.actions
is no longer valid. You will be pointing to an invalid resource.
Expected behavior
In an ideal world, the ID of the deployment step (action) would simply stay the same. I can gather that, due to how OctopusDeploy probably works at the moment, that would be quite the breaking change. The deployment steps are far too ephemeral to have deterministic terraform deployments. This borders between bug and feature because essentially, the actions
array is useless as a write-property which I see as a bug, but the proper solution would be a feature-implementation so we can better track these deployment steps as individual entities in our terraform configurations.
Alternatively, the scope.actions
array could target steps by name. Not ideal since multiple steps could have the same name, but it's at least something relatively tangible.
Environment and versions:
- OS:
Windows
- Octopus Server Version:
2021.3.12372
- Terraform Version:
1.4.6
- Octopus Terraform Provider Version:
0.12.0