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

"The resource you requested was not found." error when applying to an Octopus instance using a virtualdir. #723

Open
Justin-Walsh opened this issue Aug 9, 2024 · 0 comments
Labels
category/api Issues related to API issues. kind/bug Something isn't working

Comments

@Justin-Walsh
Copy link

Describe the bug
When using a virtualdir (https://domain/directory) for your Octopus Deploy instance, Terraform will throw a "The resource you requested was not found. []" error when attempting an apply. It looks like because the links contain the virtualdir, we're double-appending it (http://localhost/virtual/virtual/api....), resulting in a 404.

Steps to reproduce

  1. Add a Octopus binding for the following URLs: http://localhost, http://localhost/virtual.
  2. Configure a sample tf file (see below) using the virtualdir URL in the Provider address directive.
  3. Attempt to apply.
  4. 💥

Expected behavior
Apply will respect the VirtualDir and apply as expected.

Logs and other supporting information
Apply log:

Failed with exit code: 1
Error: Octopus API error: The resource you requested was not found. []
with octopusdeploy_deployment_process.database,
on template.tf line 15, in resource "octopusdeploy_deployment_process" "database":
15: resource "octopusdeploy_deployment_process" "database" {

Octopus Server logged HTTP Requests:

2024-08-09 11:28:18.3446  11128    140  INFO  "HTTP" "GET" to "localhost""/api/Spaces-1/projects/Projects-1782" "completed" with 200 in 00:00:00.0092378 (9ms) by "x"
2024-08-09 11:28:18.3446  11128    140  INFO  "HTTP" "GET" to "localhost""/api/Spaces-1/deploymentprocesses/deploymentprocess-Projects-1782" "completed" with 200 in 00:00:00.0085337 (8ms) by "x"
2024-08-09 11:28:18.3446  11128    140  INFO  "HTTP" "PUT" to "localhost""/virtual/api/Spaces-1/projects/Projects-1782/deploymentprocesses" "completed" with 404 in 00:00:00.0044581 (4ms) by "x"

Note that the PUT includes the virtualdir, which would typically be stripped in the logs. You can see this in the preceding GET.

Environment and versions:

  • Octopus Server Version: 2023.3.13181
  • Terraform Version: 1.9.4
  • Octopus Terraform Provider Version: 0.22.1 and 0.30.0-beta1

Additional context

terraform {
  required_providers {
      octopusdeploy = {
          source = "OctopusDeployLabs/octopusdeploy"
      }
  }
}

provider "octopusdeploy" {
address       = "http://localhost/virtual"
api_key       = "API-xxx"
space_id      = "Spaces-1"
}

resource "octopusdeploy_deployment_process" "database" {
  project_id = "Projects-1"
  space_id   = "Spaces-1"

  step {
    condition = "Success"

    name                = "Hello world (using PowerShell)"
    package_requirement = "LetOctopusDecide"
    start_trigger       = "StartAfterPrevious"

    run_script_action {
      can_be_used_for_project_versioning = false
      condition                          = "Success"
      is_disabled                        = false
      is_required                        = true
      name                               = "Hello world (using PowerShell)"
      script_body                        = <<-EOT
          Write-Host 'Hello world, using PowerShell 1'
          #TODO: Experiment with steps of your own :)
          Write-Host '[Learn more about the types of steps available in Octopus](https://g.octopushq.com/OnboardingAddStepsLearnMore)'
        EOT
      run_on_server                      = true
    }
  }

  step {
    condition           = "Success"
    name                = "Hello world (using Bash)"
    package_requirement = "LetOctopusDecide"
    start_trigger       = "StartWithPrevious"

    run_script_action {
      can_be_used_for_project_versioning = false
      condition                          = "Success"
      is_disabled                        = false
      is_required                        = true
      name                               = "Hello world (using Bash)"
      script_body                        = <<-EOT
          echo 'Hello world, using Bash 2'
          #TODO: Experiment with steps of your own :)
          echo '[Learn more about the types of steps available in Octopus](https://g.octopushq.com/OnboardingAddStepsLearnMore)'
        EOT
      run_on_server                      = true
    }
  }
}
@domenicsim1 domenicsim1 added the kind/bug Something isn't working label Oct 15, 2024
@mjhilton mjhilton added the category/api Issues related to API issues. label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category/api Issues related to API issues. kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants