Environment
What Is The Environment
An environment is a deployment instance managed by CloudIaC and is the core of CloudIaC managed resources.
Users can create a cloud template in an organization and run the cloud template for deployment to create a new environment and manage the environment in a project.
You can create and redeploy an environment, and destroy resources in the environment.
CloudIaC uses Terraform(terraform.tfstate profile) to maintain the status of the entire environment. Users can modify variables or resource description profiles to redeploy the environment. The new deployment will be performed in the same state as the previous one. At the same time for the destruction of resources in the environment, based on the state can also quickly achieve one-click complete cleanup.
View Environment Details
You can view your environment from the “Project” - “Environment” menu. This page lists all the environments under this item.
For each environment, you can see which cloud template it was created by, who created it, its current status, the number of resources created under the environment, and the remaining lifetime.
Click Environment to view environment details. On the environment details page, you can perform operations such as Redeploy and Destroy Resources, view the latest deployment logs, Terraform output, variables used in the deployment, and deployment history records.
Environmental State
The environment status includes the following:
1. Active: Successfully deployed and running
2. Inactive: Resource destroyed
3. Execution: Deployment or destruction in progress
4. Failed: Errors occurred during deployment
5. To be approved: After the operator initiates a deployment job, the operator waits for the approval of the Manager or Approver
Environmental Resources
When your environment is active, you simply click on the environment to view the resources it contains.
Time To Live
Livetime is the amount of time from CloudIaC’s point in time when the livetime is set to the time when the resource in the environment will be automatically destroyed (if the environment is initially created, the time will be calculated after the resource is created successfully for the first time).
You can set the duration when creating or redeploying the environment. The value can be unlimited, 12 hours, 1 day, 3 days, 1 week, half a month, 1 month, or specified time. If You select Specified Time, you can set a specific expiration time.
An environment with an unlimited lifetime will never be destroyed automatically. Usually, static environments such as production environments will be set to an unlimited lifetime, while development and test environments can be set to an appropriate lifetime as required.
Create Environment
To create an environment, select Project - Cloud Template, and click Deploy on the template you want to use.
Before starting deployment, you need to set up the environment details: environment name, lifetime, which branch or tag to create based on the repository, and determine which zone you want to deploy in, selecting the deployment channel under the appropriate zone.
Variables are usually defined in the cloud template. You can adjust the values of variables as required.
Click Deploy. The environment details page is displayed. Execution logs are displayed in real time, and output and status are stored during deployment.
Destruction Of Resources
There are two ways to destroy resources in the environment.
One is to set the “time to live” environment, it will be automatically destroyed when the time limit is reached.
The other is manual destruction. On the “Environment Details” page, click “Destroy Resources” in the upper right corner to perform the destruction operation.
When the resources in the active environment are destroyed successfully, the environment status will be set to inactive, if the resource destruction fails, the environment status will be set to failed.
Redeploy The Environment
For the created environment, you can redeploy. On the environment details page, click “Redeploy” in the upper right corner to proceed.
If your environment is currently running deployment or destruction tasks, you cannot initiate a new deployment. You need to wait for the completion of the previous deployment to initiate a new task.
When you redeploy the “inactive” environment, after the deployment is successful, the environment status will automatically change to “active”.
When redeploying, unless the survival time is manually reset, the original survival time of the environment will be used by default.
Automatic Retry
When performing environment deployment operations, you may want CloudIaC to automatically retry when an error occurs.
For each cloud template, you can enable automatic retry, and configure the retry interval and number of times.
Each deployment of CloudIaC will have multiple steps. Retrying will only re-execute the current step, and the steps that are executed quickly will not be repeated.
Approval Process
For each creation, destruction, or redeployment operation performed in the environment, CloudIaC first creates a Terraform Plan, and then enters the “Pending Approval” state, which needs to be approved by the manager or Approver role user of the project before the deployment can continue.
Users in Manager or Approver roles can select “Automatically pass approval” when creating an environment to automatically approve in subsequent deployment operations without waiting.
If the user does not set automatic approval, CloudIaC will wait after the Terraform plan is created, until the Manager or Approver actively approves the execution plan.
Archive environment
To help users manage the environment, CloudIaC allows users to archive environments that are no longer in use (inactive state), and the archived environment will no longer be available.