:original_name: en-us_topic_0000001955571466.html .. _en-us_topic_0000001955571466: Creating a Stack ================ #. Start creating a stack There are four ways to start creating a stack here: a. On the Dashboard page, click Create Stack in the upper right corner, as shown in :ref:`Figure Creating a stack on Dashboard `. b. On the Stacks page , click Create Stack in the upper right corner, as shown in :ref:`Figure Creating a stack on Stacks page `. c. On the Templates -> My Templates page, click Create Stack under the Operation column associated with an existing template, as shown in :ref:`Figure Creating a stack on My Templates page `. d. On the template details page, click Create Stack under the Operation column associated with a specific template version, as shown in :ref:`Figure Creating a stack on template details page `. .. _en-us_topic_0000001955571466__fig1102195810527: .. figure:: /_static/images/en-us_image_0000002156043281.png :alt: **Figure 1** Creating a stack on Dashboard **Figure 1** Creating a stack on Dashboard .. _en-us_topic_0000001955571466__fig14448537155319: .. figure:: /_static/images/en-us_image_0000002155961665.png :alt: **Figure 2** Creating a stack on Stacks page **Figure 2** Creating a stack on Stacks page .. _en-us_topic_0000001955571466__fig103713552537: .. figure:: /_static/images/en-us_image_0000002120721540.png :alt: **Figure 3** Creating a stack on My Templates page **Figure 3** Creating a stack on My Templates page .. _en-us_topic_0000001955571466__fig107841574534: .. figure:: /_static/images/en-us_image_0000002120563432.png :alt: **Figure 4** Creating a stack on template details page **Figure 4** Creating a stack on template details page 2. Select Template There are three ways to select a template, as shown in :ref:`Figure Selecting a template `: a. Select a template from **My Templates**: Template name and version selector dropdowns. b. Enter a URL of an OBS template: Template URL dropdown. (The URL must contain at least the deployment code file, and the file size cannot exceed 1 MB.) Example: https://test-stack-template.obs.eu-de.otc.t-systems.com/main.tf c. Upload a local template file: click "Add File" button. Then click **Next** to go to the parameter configuration page. .. important:: The .tf, .tf.json, and .zip files are supported. At least the deployment code file needs to be uploaded. The size of a file cannot exceed 50 KB. The size of a decompressed .zip file cannot exceed 1 MB. .. _en-us_topic_0000001955571466__fig133342145369: .. figure:: /_static/images/en-us_image_0000002156043285.png :alt: **Figure 5** Selecting a template **Figure 5** Selecting a template .. caution:: - A stack is created using a template. The template must contain the deployment code file which file name extension is tf or tf.json. - The deployment code file must use the open source HCL syntax. After the file is imported, the corresponding resource configuration table is generated for users to configure resource parameters. This file must be provided in URL or via template upload. - When using the RFS service, users do not need to specify the "access_key" and "secret_key" fields under the **provider block** in the template. - RFS only uses the data you upload for resource management. The following is an example of uploading a local template file. In this example, the **ecs_test.tf.json** file is uploaded. The template content is as follows: .. code-block:: { "terraform": { "required_providers": { "opentelekomcloud": { "source": "opentelekomcloud/provider/opentelekomcloud", "version": "1.35.13" } } }, "provider": { "opentelekomcloud": { "region": "eu-de", "insecure": true, "auth_url": "https://iam.eu-de.otc.t-systems.com/v3", "tenant_name": "eu-de", "domain_name": "OTC-EU-DE-xxxxxxxxxxxxxxxxxxxx", "user_name": "xxxxxxxxxx" } }, "variable": { "vpc_name": { "type": "string", "description": "vpc name", "default": "rf_test_stack_example_vpc", "sensitive": true, "nullable": false }, "subnet_name": { "type": "string", "description": "subnet name", "default": "rf_test_stack_example_subnet" }, "ecs_name": { "type": "string", "description": "ecs name", "default": "rf_test_stack_example_ecs" }, "compute_keypair_name": { "type": "string", "description": "ecs compute key pair name", "default": "rf_test_stack_example_keypair" }, "storage_volume_name": { "type": "string", "description": "storage volume name", "default": "rf_test_stack_example_volume" } }, "resource": { "opentelekomcloud_vpc_v1": { "rf_doc_vpc": { "name": "${var.vpc_name}", "cidr": "192.168.0.0/16" } }, "opentelekomcloud_vpc_subnet_v1": { "rf_doc_subnet": { "name": "${var.subnet_name}", "vpc_id": "${opentelekomcloud_vpc_v1.rf_doc_vpc.id}", "cidr": "192.168.1.0/24", "gateway_ip": "192.168.1.1" } }, "opentelekomcloud_compute_keypair_v2": { "rf_doc_keypair": { "name": "${var.compute_keypair_name}" } }, "opentelekomcloud_compute_instance_v2": { "rf_doc_ecs": { "name": "${var.ecs_name}", "flavor_id": "s2.large.1", "image_id": "c93ca99f-c5ee-451b-96e6-08c772edaec9", "availability_zone": "eu-de-01", "key_pair": "${opentelekomcloud_compute_keypair_v2.rf_doc_keypair.name}", "security_groups": ["default"], "network": { "uuid": "${opentelekomcloud_vpc_subnet_v1.rf_doc_subnet.id}" } } }, "opentelekomcloud_blockstorage_volume_v2": { "rf_doc_volume": { "name": "${var.storage_volume_name}", "size": 4, "availability_zone": "eu-de-01" } }, "opentelekomcloud_compute_volume_attach_v2": { "rf_doc_volume_attach": { "instance_id": "${opentelekomcloud_compute_instance_v2.rf_doc_ecs.id}", "volume_id": "${opentelekomcloud_blockstorage_volume_v2.rf_doc_volume.id}" } } }, "output": { "ecs_address": { "value": "${opentelekomcloud_compute_instance_v2.rf_doc_ecs.access_ip_v4}", "description": "The ecs private address." }, "ecs_id": { "value": "${opentelekomcloud_compute_instance_v2.rf_doc_ecs.id}", "description": "The ecs resource id." } } } .. caution:: The sample template contains charged resources. Check whether resources need to be enabled before using the template. The template consists of eight parts: - **opentelekomcloud_vpc_v1** in **resource** indicates VPC information. - **opentelekomcloud_vpc_subnet_v1** in **resource** indicates information about a subnet defined in the VPC. - **opentelekomcloud_compute_keypair_v2** in **resource** indicates information about compute keypair defined in the template. - **opentelekomcloud_compute_instance_v2** in **resource** indicates information about an ECS defined in the template. - **opentelekomcloud_blockstorage_volume_v2** in **resource** indicates information about an EVS storage volume defined in the template. - **opentelekomcloud_compute_volume_attach_v2** in **resource** indicates the binding relationship between EVS storage volumes and ECS. - **variable** indicates variables defined by users in templates during stack creation and deployment. - **output** defines the outputs of templates. After a stack is created, its output is generated based on the definition and displayed on the :ref:`Outputs ` tab page. For detailed usage of other resources, please refer to `OpenTelekom Cloud Provider `__. 3. Configure parameters On the parameter configuration page, you can modify the stack name and description and can configure the template parameters, as shown in :ref:`Figure Configuring parameters `. .. caution:: The stack name must start with a letter and can contain a maximum of 128 characters, including letters, digits, underscores (_), and hyphens (-). The name must be unique. A stack description can contain a maximum of 255 characters. .. _en-us_topic_0000001955571466__fig179172325107: .. figure:: /_static/images/en-us_image_0000002120705156.png :alt: **Figure 6** Configuring parameters **Figure 6** Configuring parameters Parameters for which the 'nullable' field is set to 'false' in template is marked with a red asterisk (``*``) are mandatory. Set these parameters to valid values. When certain variables in the template have the field 'sensitive' set to true, KMS encryption can be selected, as shown in :ref:`Figure Encrypt requirements `. After encryption is enabled, RFS uses KMS to encrypt parameters whose sensitive is set to true in the template, to ensure that data is transmitted and stored in ciphertext. .. _en-us_topic_0000001955571466__fig15774183016141: .. figure:: /_static/images/en-us_image_0000002156056533.png :alt: **Figure 7** Encrypt requirements **Figure 7** Encrypt requirements If a value is invalid, the corresponding text box will turn red (as shown in :ref:`Figure 8 `) and page redirection will not be triggered after you click **Next**. .. _en-us_topic_0000001955571466____d0e644: .. figure:: /_static/images/en-us_image_0000001991770641.png :alt: **Figure 8** Text box with an invalid value **Figure 8** Text box with an invalid value Check whether the default VPC, subnet, and ECS names used on this page already exist on the corresponding consoles. If the names already exist, change them to unique ones to prevent creation failures. Then click **Next**. The **Configure Stack** page is displayed. 4. .. _en-us_topic_0000001955571466__li459mcpsimp: Configure the stack. Optional parameters , as shown in :ref:`Figure 9 `: **IAM Agency (Optional)**: An agency can clearly define operation permissions of RFS (such as creation, update, and deletion) on stack resources. If the agency permissions are insufficient, subsequent operations may fail. For more details of how to create agency, see :ref:`create an agency `. **Deletion Protection**: prevents the stack from being deleted accidentally. After a stack is created, You can modify it on the stack details page. **Auto-Rollback**: If auto-rollback is enabled, the stack automatically rolls back to the previous successful resource status when an operation fails. After the stack is created, you can modify the stack configurations on its details page. Click **Next** to go to the **Confirm Configurations** page. .. _en-us_topic_0000001955571466____d0e688: .. figure:: /_static/images/en-us_image_0000001991890825.png :alt: **Figure 9** Configuring the stack **Figure 9** Configuring the stack 5. Check the configuration and make sure everything is set correctly. After you confirm the configurations, you can click either **Create Execution Plan** or **Directly Deploy Stack**. - If you click **Directly Deploy Stack**, a :ref:`confirmation dialog box ` will be displayed. .. _en-us_topic_0000001955571466__fig38972020557: .. figure:: /_static/images/en-us_image_0000002156063229.png :alt: **Figure 10** Directly deploy stack **Figure 10** Directly deploy stack a. Click **Yes**. A new stack is generated and its status is **Deployment In Progress**, as shown in :ref:`Figure 11 `. And it will redirect to the stack events page, as shown in :ref:`Figure Stack Events `. .. _en-us_topic_0000001955571466____d0e756: **Figure 11** Deployment in progress |image1| .. _en-us_topic_0000001955571466__fig173401257402: .. figure:: /_static/images/en-us_image_0000002120746402.png :alt: **Figure 12** Stack Events **Figure 12** Stack Events b. Then, if everything goes well, the status changes to **Deployment Complete**, as shown in :ref:`Figure Deployment complete `. .. _en-us_topic_0000001955571466__fig73237820229: **Figure 13** Deployment complete |image2| - If you click **Create Execution Plan**, a dialog box of creating execution plan will be displayed. In this dialog box, you can set the name and description of the execution plan, as shown in :ref:`Figure Create Execution Plan dialog box `. .. _en-us_topic_0000001955571466__fig1032312852212: .. figure:: /_static/images/en-us_image_0000002156141609.png :alt: **Figure 14** Create Execution Plan dialog box **Figure 14** Create Execution Plan dialog box .. caution:: The execution plan name must start with a letter and can contain a maximum of 128 characters,eincluding only letters, digits, underscores(_), and hyphens (-). a. Click **OK**. The **Execution Plans** tab page is displayed. b. Wait until the execution plan is created and refresh the page. The execution plan status changes to **Available**, as shown in :ref:`Figure Execution Plan Available `. .. _en-us_topic_0000001955571466__fig432318842212: **Figure 15** Execution Plan Available |image3| c. Return to the stack list page. The stack status is **Creation Complete**, as shown in :ref:`Figure 16 `. .. _en-us_topic_0000001955571466____d0e813: **Figure 16** Stack list |image4| .. caution:: **Creating an execution plan** can preview the resource attribute changes of the entire stack and evaluate the impact. If the execution plan meets your expectations, you can execute the plan. Creating an execution plan does not incur fees. The system changes your stack only when you execute the plan. d. Click **Deploy** in the **Operation** column of the execution plan to deploy it, as shown in :ref:`Figure 17 `. .. _en-us_topic_0000001955571466____d0e835: .. figure:: /_static/images/en-us_image_0000002120743398.png :alt: **Figure 17** Execution plan dialog box **Figure 17** Execution plan dialog box e. In the **Execution Plan** dialog box, click **Execute**. A message indicating that the execution plan is being deployed is displayed in the upper right corner. Return to the stack list page. A new stack is generated and its status is **Deployment In Progress**, as shown in :ref:`Figure Deployment in progress `. .. _en-us_topic_0000001955571466__fig65231214111516: .. figure:: /_static/images/en-us_image_0000002156141613.png :alt: **Figure 18** Deployment in progress **Figure 18** Deployment in progress f. Then, the stack status changes to **Deployment Complete**, as shown in :ref:`Figure 19 `. .. _en-us_topic_0000001955571466____d0e866: **Figure 19** Deployment complete |image5| g. On the **Execution Plans** tab page of the stack details page, the execution plan status is **Applied**, as shown in :ref:`Figure 20 `. .. _en-us_topic_0000001955571466____d0e882: .. figure:: /_static/images/en-us_image_0000002120901494.png :alt: **Figure 20** Applied **Figure 20** Applied Click the **Events** tab. The event list shows that resources of the stack are deployed, as shown in :ref:`Figure 21 `. .. _en-us_topic_0000001955571466____d0e895: **Figure 21** Resources deployed |image6| You can view additional details on the console of the corresponding cloud service.(:ref:`Figure ECS `\ shows the deployed resources on the ECS console for the above example). .. _en-us_topic_0000001955571466__fig1268133163913: .. figure:: /_static/images/en-us_image_0000002120901474.png :alt: **Figure 22** ECS **Figure 22** ECS Resources of the stack are deployed. .. |image1| image:: /_static/images/en-us_image_0000002120901486.png .. |image2| image:: /_static/images/en-us_image_0000002120743394.png .. |image3| image:: /_static/images/en-us_image_0000002156064705.png .. |image4| image:: /_static/images/en-us_image_0000002120745830.png .. |image5| image:: /_static/images/en-us_image_0000002156063237.png .. |image6| image:: /_static/images/en-us_image_0000002120743374.png