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

Project scheduled trigger read failure

Open hans-m-song opened this issue 1 year ago • 1 comments
trafficstars

Describe the bug A clear and concise description of what the bug is.

The provider cannot find project triggers once created or when attempting to import. It fails with the error

Octopus API error: Resource is not found or it doesn't exist in the current space context. Please contact your administrator for more information. []

Steps to reproduce

  1. Define a scheduled project trigger
    resource "octopusdeploy_project_scheduled_trigger" "foo" {
      name       = "foo"
      project_id = "Projects-2024"
      space_id   = "Spaces-202"
      run_runbook_action {
        runbook_id             = "Runbooks-865"
        target_environment_ids = ["Environments-366"]
      }
      cron_expression_schedule {
        cron_expression = "0 0 * * *" # daily
      }
    }
    
  2. Attempt to plan
    terraform plan -target=octopusdeploy_project_scheduled_trigger.foo
    
    or attempt to import
    terraform import octopusdeploy_project_scheduled_trigger.foo ProjectTriggers-103
    
  3. See error

Expected behavior A clear and concise description of what you expected to happen.

The provider succeeds in discovering the scheduled project trigger

Logs and other supporting information Add the output of running tf plan or tf apply along with any errors in the Octopus Server logs.

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Warning: Resource targeting is in effect
│
│ You are creating a plan with the -target option, which means that the result of this plan may not represent all
│ of the changes requested by the current configuration.
│
│ The -target option is not for routine use, and is provided only for exceptional situations such as recovering
│ from errors or mistakes, or when Terraform specifically suggests to use it as part of an error message.
╵
╷
│ Error: Octopus API error: Resource is not found or it doesn't exist in the current space context. Please contact your administrator for more information. []
│
│   with octopusdeploy_project_scheduled_trigger.sandbox_cleanup_report,
│   on projects_administration.tf line 108, in resource "octopusdeploy_project_scheduled_trigger" "sandbox_cleanup_report":
│  108: resource "octopusdeploy_project_scheduled_trigger" "sandbox_cleanup_report" {
│
╵

Screenshots If applicable, add screenshots to help explain your problem.

N/A

Environment and versions:

  • OS: Linux, OSX
  • Octopus Server Version: 2024.3.10026
  • Terraform Version: 1.8.2
  • Octopus Terraform Provider Version: 0.18.1

Additional context Add any other context about the problem here.

It doesn't appear newer versions of the provider have touched this resource but I have not upgraded as the migration to tenant_project resources is a breaking change which is going to require a fair amount of work

hans-m-song avatar Aug 15 '24 04:08 hans-m-song

Labelling with triage/potentially-stale because of the version that this bug was repro'd in. I'd like us to repro on the latest version to confirm the behaviour.

mjhilton avatar Sep 30 '24 23:09 mjhilton