Octopus deploy process step to upload to s3 bucket showing error "Error: octopus deploy api returned an error on endpoint /api/Spaces-163/projects/Projects-139/deploymentprocesses -

We are using terraform to configure the octopus resources and i am getting the following error when creating deployment process with step upload to s3. Any idea why?

Octopus deploy process step to upload to s3 bucket showing error “Error: octopus deploy api returned an error on endpoint /api/Spaces-163/projects/Projects-139/deploymentprocesses - [Please provide the S3 file(s) package.]”

Thanks,
Vinu

Hi @vinu.vincent,

Welcome to the community, and thanks for posting your issue! I’m sorry to hear you’re hitting that error, but I’ll help investigate this with you.

If you’re willing to provide me with a deployment task log from the failed deployment, as well as your Terraform file, I’ll review those for further context. You can use the following link to upload this to me securely:

Vinu Vincent | Octopus Support

Let me know once you’ve done that and I’ll take a look.

Best,

Patrick

I am getting the error while creating the deploy process from terraform. I have attached the error log.

Here is the terraform code used.

resource “octopusdeploy_deployment_process” “app” {
provider = octopusdeploy.app

project_id = var.octopusdeploy_project_id

step {
condition = “Success”
name = “Development”
target_roles = [“development”]

action {
  name           = "Development"
  action_type    = "Octopus.AwsUploadS3"
  channels       = [var.channel_development]
  environments   = var.development_envs
  worker_pool_id = var.worker_pool_id_development
  properties = {
    "Octopus.Action.Aws.AssumeRole"             = "True"
    "Octopus.Action.Aws.AssumedRoleArn"         = ""
    "Octopus.Action.Aws.AssumedRoleSession"     = "test-session"
    "Octopus.Action.Aws.Region"                 = "us-east-1"
    "Octopus.Action.Aws.S3.BucketName"          = "#{PAYMENTS_MERCHANT_BUCKET}"
    "Octopus.Action.Aws.S3.FileSelections"      = "[{\"type\":\"MultipleFiles\",\"tags\":[],\"metadata\":[],\"cannedAcl\":\"private\",\"path\":\"build/index.html\",\"storageClass\":\"STANDARD\",\"bucketKey\":\"build/index.html\",\"bucketKeyPrefix\":\"build/\",\"bucketKeyBehaviour\":\"Custom\",\"performVariableSubstitution\":\"False\",\"performStructuredVariableSubstitution\":\"False\",\"pattern\":\"build/**/*\",\"variableSubstitutionPatterns\":\"\"}]"
    "Octopus.Action.Aws.S3.PackageOptions"      = "{\"bucketKey\":\"\",\"bucketKeyBehaviour\":\"Custom\",\"bucketKeyPrefix\":\"\",\"storageClass\":\"STANDARD\",\"cannedAcl\":\"private\",\"variableSubstitutionPatterns\":\"**/*\",\"structuredVariableSubstitutionPatterns\":\"\",\"metadata\":[],\"tags\":[],\"autoFocus\":true}"
    "Octopus.Action.Aws.S3.TargetMode"          = "FileSelections"
    "Octopus.Action.AwsAccount.UseInstanceRole" = "False"
    "Octopus.Action.AwsAccount.Variable"        = "AWS_ACCOUNT"
    "Octopus.Action.Package.DownloadOnTentacle" = "False"
    "Octopus.Action.Package.FeedId"             = "octopus-server-built-in"
    "Octopus.Action.Package.PackageId"          = "payments-merchant#{PACKAGE_VERSION}"
  }
    package {
      name                 = "S3-package"
      acquisition_location = "Server"
      feed_id              = "octopus-server-built-in"
      package_id           = "payments-merchant#{PACKAGE_VERSION}"
      properties = {
        SelectionMode = "immediate"
      }
    }
}

}

Hi @vinu.vincent,

Just stepping in for Patrick while he’s offline, cheers for providing the Terraform code.

Could you please also confirm which version of our TF provider you are using? I’ll work on getting a reproduction of the issue and see if there is an issue to raise.

I am aware that we are deprecating the generic action for specific action types e.g. run_script_action however there doesn’t seem to be a corresponding S3 upload action just yet. I’ll reach out about if it’s likely to be added in and keep you posted with any updates.

Feel free to reach out if you have any questions at all!

Best Regards,

Hi,

We are using TF provider version “0.10.3”.

Thanks,
Vinu

1 Like

Hi @vinu.vincent,

I was able to reproduce the error and workaround it by not including a value for the name property in the package reference:

package {
  name                 = ""
  acquisition_location = "Server"
  feed_id              = "octopus-server-built-in"
  package_id           = "payments-merchant#{PACKAGE_VERSION}"
  properties = {
  SelectionMode = "immediate"
  }
}

Let me know if that doesn’t work on your end or you have any questions at all!

Best Regards,

Hi @finnian.dempsey


I was able to create it after changing the value of name to null. Now getting some other already package already exists error which i think i can resolve. Let me know if you have any insight to this error. Thanks for the support. It saved my time.

Thanks,
Vinu Vincent

Hi
I am getting the following error. Any idea?

Thanks,
Vinu

Hey @vinu.vincent,

Just stepping in for Fin and Patrick as they are both currently offline as part of our Australian and US teams.

I am sorry you are seeing another error whilst trying to get this to work, I did come across this GitHub issue here which, although it looks to be associated with a different action type (“Octopus.JavaArchive”), it may help. I noticed one of our engineers on the last comment of the issue used:

 primary_package {
        package_id           = "com.maven:app:war"
        feed_id              = octopusdeploy_feed.maven.id
        acquisition_location = "ExecutionTarget"
      }

Instead of package as you have used, I am not as familiar with Terraform as Finnian is but I know you can use primary_package from the documentation from TF 0.10.3 so I am wondering if you could give that a go instead and see if that gets you past the error you are currently seeing?

From the looks of the engineers comment in the GitHub issue if you use primary_package you dont need to put a null for a name (or a name at all) as its implied the name is empty.

Give that a go and let me know if it works, it is a long shot but it may help, Patrick will be online a bit later on today but Finnian has gone for the weekend as it is Friday night in Australia so if this does not work one of them may be able to pick this up later on today or Sunday night.

I look forward to hearing from you,
Kind Regads,
Clare

Hi,

We are getting the attached error. Any idea about this error? Where will be failure.

Hey @vinu.vincent,

That error seems to suggest it doesn’t like the id you have for the Octopus server built in feed.

Looking at my API call (I am on Octopus Server 2023.1.9722) I have a step with a package from my built in feed and the call for the feed id is:

          "Packages": [
            {
              "Id": "8a3f35e7-692a-4de7-ac95-7c304a68930c",
              "Name": "",
              "PackageId": "JhubSite",
              "FeedId": "feeds-builtin",
              "AcquisitionLocation": "Server",
              "Properties": {
                "SelectionMode": "immediate"
              }
            }

Looking at your feed ID you have feed_id = "octopus-server-built-in" so possibly try changing that to:

feed_id = "feeds-builtin"

See if that works? I cant find in and example in our Terraform documentation of the built-in feed, its just for external feeds so I am unable to confirm.

I look forward to hearing from you,
Kind Regards,
Clare

Hi,

We are getting the attached error when i enable “packages” code block in terraform.

We are getting the following error when i deploy it. Any idea why?

There was a problem with your request.

  • The feed octopus-server-built-in referenced by steps in this project no longer exists. Once you have corrected these problems you can try again. If the problem is related to a variable you will need to update the variables for this release or recreate the release for the changes to take effect. If the problem is related to the deployment process you will need to create a new release for the changes to take effect.

Thanks,
Vinu

Hey @vinu.vincent,

Is your project you are trying to update here in the default space or in another space?

If your project is in the default space you need to change your TF code from:

feed_id = "octopus-server-built-in"

to

feed_id = "feeds-builtin"

If you are not using the default space you will need to see what your API call says from the space you are trying to update this project from and see what that references as the built in feed id. This is because the built in feed for each space is different so the id’s will be different, sorry I missed that you might not be using the default space here so did not mention this before.

For example, if I have a project in another space (that’s not my default space) I would need to access the API of that projects deployment steps ie: http://localhost/api/Spaces-2/projects/Projects-701/deploymentprocesses. You can then see what your feed id is. Mine for that space is:

"Octopus.Action.Package.FeedId": "Feeds-1001"

So my TF code would be:

feed_id = "Feeds-1001"

I can now actually see this is sort of alluded to in the Terraform documentation here.

So, your terraform code for the package will be:

 primary_package {
        package_id           = "payments-merchant#{PACKAGE_VERSION}"
        feed_id              = "Feeds-1001"
        acquisition_location = "Server"
      }

Obviously change the feed_id to whatever your API says it is.

Let me know if the project you are trying to update is in the default space though and we can dig a bit further, hopefully that helps!

Kind Regards,
Clare

Hi @clare.martin ,

Got it. We are not using default space. We got the feed id from API. trying it now. I will let you know if any further error.

Thanks,
Vinu

1 Like

Hi @clare.martin ,

We were able to deploy the application. We need to recreate the release then only its taking it properly. Thanks for all the support.

Thanks,
Vinu

Hey @vinu.vincent,

Fantastic news you are able to deploy now! Sorry I missed the spaces change earlier but we collectively got there! Thank you for your patience whilst we worked through this with you.

If you need anything further reach out as we are always on hand to help!

Kind Regards and Happy Deployments,
Clare

1 Like

Hi @clare.martin

We are not using default space instead we are using custom space. When i try to get the feedid(using terraform) for feed_type “BuiltIn” with specific space_id, i am getting value “Feeds 2023-03-28 09:51:08.458327337 +0000 UTC” instead of the feed id.

Here is the data code used to fetch the feed_id for space id
data “octopusdeploy_feeds” “build_in_feed” {
feed_type = “BuiltIn”
name = “test”
}

Let me know how to get the BuiltIn feedid for “feeds-builtin” for a custom space.

Thanks,
Vinu

Hey @vinu.vincent,

Sorry, I thought you got this working? Your comment above seemed to suggest you can deploy the application. I apologise if I misread that.

If you are not using the default space I mentioned how you get the feed-id for that space in a previous comment but I will outline it below in case that was missed:

If you are not using the default space you will need to see what your API call says from the space you are trying to update this project from and see what that references as the built in feed id. This is because the built in feed for each space is different so the id’s will be different, sorry I missed that you might not be using the default space here so did not mention this before.

For example, if I have a project in another space (that’s not my default space) I would need to access the API of that projects deployment steps ie: http://localhost/api/Spaces-2/projects/Projects-701/deploymentprocesses. You can then see what your feed id is. Mine for that space is:

"Octopus.Action.Package.FeedId": "Feeds-1001"

So my TF code would be:

feed_id = "Feeds-1001"

Let me know if that helps at all, I don’t think you can get the feed-id value from Terraform itself, you would need to get it from the API. I can ask our engineers but I am pretty sure you can only get this value from the API.

Kind Regards,
Clare

Hi @clare.martin
I got the logic but i am not able to get the feedId for the specific space from terraform using data. I am not sure if I miss something in this. I tried to use the following terraform data block to get the feedID for particular space but i am getting result as some date/time.

data “octopusdeploy_feeds” “build_in_feed” {
feed_type = “BuiltIn”
name = “test”
}

The output I am getting is(data.octopusdeploy_feeds.build_in_feed.id):

“Feeds 2023-03-28 11:31:58.104456647 +0000 UTC”

I am not able to get the FeedID. Any idea how to get it from terraform?

Thanks,
Vinu Vincent

Hey @vinu.vincent,

I have asked our engineers if it is possible to get the feed-id from Terraform, I am not sure you can but the engineers will know and should hopefully be able to get me the code in order to grab the feed Id if Terraform is able to.

I will update you when they get back to me, they are based in Australia so I will not hear back from them until later tonight, I am UK based so you will get an answer tomorrow morning from me on whether this is possible or not.

Kind Regards,
Clare