How can I create a tenant and deploy to it dynamically?

Hey,

I’ve got a project that creates dynamically named tenants as part of our CI pipeline. Octopus creates a tenant using some predefined naming standard that generates a random 7 character suffix as part of the tenant name. It successfully spins up infrastructure and assigns it to the tenant and leaves it in a state that it could then run the application deployment which is another Octopus Project.

I could have this project run a “Deploy a Release” step and pass it the newly created tenant, but I can’t figure out how to get Octopus to pass the newly created tenant’s name into the step.

Is this possible? If so, how?

Cheers,

Ben Alabaster

Hi Ben,

Thanks for your question.

The Deploy a Release step doesn’t accept a tenant as a parameter. Instead, it deploys to the same tenant that the calling project is being deployed to.

In your case, using the API to create the deployment for the new tenant is a better option.

You can use this sample script as a starting point. You can execute your script manually or as a step in your build or you deploy process. If you do hook the call into your CI process, you could use one of our plugins to deploy the release to the tenant. Which CI server are you using?

Let me know if you have any other questions on this.

Best,
Ryan