1. Deployment configuration:
- Tensor9 preserves any backend configuration you include in your origin stack. You are responsible for managing Terraform state according to your deployment requirements.
- You should use the
instance_idvariable in your backend configuration to ensure each appliance has a unique state file location. Your deployment tool uses this ID to maintain a consistent state file location across deployment runs.
2. Execution (example: Atlantis):
- Your CI/CD tool (e.g., Atlantis) fetches the Compiled Stack from Tensor9.
- It executes the standard Terraform commands:
tofu inittofu plan(for review)tofu apply(upon approval)
- Best Practice: Maintain a separate Git repository for the compiled stacks to keep your source code history clean.
Integration with Atlantis
Atlantis is an open-source tool that automates Terraform via pull requests (PRs).| Workflow Step | Action with Tensor9 |
|---|---|
| 1. Create PR | A vendor (or an automated script) makes a change in the Origin Stack repository and runs the Tensor9 stack build step. This generates a new version of the compiled stacks. |
| 2. Push Compiled Stacks | Push the new compiled stack files to the separate repository and open a new Pull Request (PR). |
| 3. Automated Plan | Atlantis detects the PR in the compiled stacks Repository and automatically runs tofu plan. The output is posted as a comment on the PR. |
| 4. Configure Workspace ID | The Origin Stack should contain the configuration for Atlantis. The vendor must pass a consistent Appliance ID as a workspace ID environment variable to Atlantis. This ensures that the Terraform state is managed correctly for each customer appliance. |
| 5. Apply | Once the plan is reviewed and approved, a user comments atlantis apply on the PR. |
| 6. Update/Rollback | Update is the same as a new deploy. For a Rollback, you must check out the desired old version of the Origin Stack, re-compile it with Tensor9, and then open a new PR. |
Integration with Spacelift
Spacelift is a complete CI/CD platform for Infrastructure as Code, using Stacks for deployment.| Workflow Step | Action with Tensor9 |
|---|---|
| 1. Connect Repository | Create a Spacelift Stack connected to your compiled stacks repository. |
| 2. Trigger Run | Similar to Atlantis, pushing a new version of the compiled stacks to the repository branch, or opening a PR, triggers a run in Spacelift. |
| 3. Plan & Apply | Spacelift executes the tofu plan and tofu apply workflow. Spacelift’s Stacks combine the configuration (compiled code), variables, and state data for each customer appliance. |
| 4. Customization | Spacelift allows for extensive customization of the workflow, which can be used to set up environment variables for the required Appliance ID (analogous to the workspace ID in Atlantis). |
instance_id variable to maintain unique state files for each appliance. See Backend Configuration for details.
Updating applications
To update an appliance, create a new build (compile) using the latest source code and then trigger a new deployment run via your CI/CD tool. Here is an example update scenario: A vendor is using Tensor to deploy a VM into customer environment. They realize the instance type is too small; they need more memory and CPU. Using Tensor9, they can change to an instance type with more memory and CPU. They simplify runtofu apply with the new instance type, resulting in an update wherein the
instance type changes, e.g., from t2.micro to t5g.large.
Rollback: To roll back, you must check out the desired previous version of your Origin Stack code, create a new compiled stack from that old code, and then deploy the resulting compiled stack.