18 KiB

original_name

en-us_topic_0000001955571466.html

Creating a Stack

  1. Start creating a stack

    There are four ways to start creating a stack here:

    1. On the Dashboard page, click Create Stack in the upper right corner, as shown in Figure Creating a stack on Dashboard <en-us_topic_0000001955571466__fig1102195810527>.
    2. On the Stacks page , click Create Stack in the upper right corner, as shown in Figure Creating a stack on Stacks page <en-us_topic_0000001955571466__fig14448537155319>.
    3. On the Templates -> My Templates page, click Create Stack under the Operation column associated with an existing template, as shown in Figure Creating a stack on My Templates page <en-us_topic_0000001955571466__fig103713552537>.
    4. On the template details page, click Create Stack under the Operation column associated with a specific template version, as shown in Figure Creating a stack on template details page <en-us_topic_0000001955571466__fig107841574534>.
Figure 1 Creating a stack on Dashboard
Figure 2 Creating a stack on Stacks page
Figure 3 Creating a stack on My Templates page
Figure 4 Creating a stack on template details page
  1. Select Template

    There are three ways to select a template, as shown in Figure Selecting a template <en-us_topic_0000001955571466__fig133342145369>:

    1. Select a template from My Templates: Template name and version selector dropdowns.

    2. 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

    3. 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.

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:

{
    "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 Outputs <en-us_topic_0000001991770629__li167036103014> tab page.

For detailed usage of other resources, please refer to OpenTelekom Cloud Provider.

  1. Configure parameters

    On the parameter configuration page, you can modify the stack name and description and can configure the template parameters, as shown in Figure Configuring parameters <en-us_topic_0000001955571466__fig179172325107>.

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.

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 Figure Encrypt requirements <en-us_topic_0000001955571466__fig15774183016141>. 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.

Figure 7 Encrypt requirements

If a value is invalid, the corresponding text box will turn red (as shown in Figure 8 <en-us_topic_0000001955571466____d0e644>) and page redirection will not be triggered after you click Next.

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.

  1. Configure the stack.

    Optional parameters , as shown in Figure 9 <en-us_topic_0000001955571466____d0e688>:

    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 create an agency <en-us_topic_0000001991890817>.

    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.

    Figure 9 Configuring the stack
  2. 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 confirmation dialog box <en-us_topic_0000001955571466__fig38972020557> will be displayed.
    Figure 10 Directly deploy stack
    1. Click Yes. A new stack is generated and its status is Deployment In Progress, as shown in Figure 11 <en-us_topic_0000001955571466____d0e756>. And it will redirect to the stack events page, as shown in Figure Stack Events <en-us_topic_0000001955571466__fig173401257402>.

    Figure 11 Deployment in progress

    image1

    Figure 12 Stack Events
    1. Then, if everything goes well, the status changes to Deployment Complete, as shown in 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 Figure Create Execution Plan dialog box <en-us_topic_0000001955571466__fig1032312852212>.
    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 (-).

    1. Click OK. The Execution Plans tab page is displayed.
    2. Wait until the execution plan is created and refresh the page. The execution plan status changes to Available, as shown in Figure Execution Plan Available <en-us_topic_0000001955571466__fig432318842212>.

    Figure 15 Execution Plan Available

    image3

    1. Return to the stack list page. The stack status is Creation Complete, as shown in 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.

    1. Click Deploy in the Operation column of the execution plan to deploy it, as shown in Figure 17 <en-us_topic_0000001955571466____d0e835>.
    Figure 17 Execution plan dialog box
    1. 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 Figure Deployment in progress <en-us_topic_0000001955571466__fig65231214111516>.
    Figure 18 Deployment in progress
    1. Then, the stack status changes to Deployment Complete, as shown in Figure 19 <en-us_topic_0000001955571466____d0e866>.

    Figure 19 Deployment complete

    image5

    1. On the Execution Plans tab page of the stack details page, the execution plan status is Applied, as shown in Figure 20 <en-us_topic_0000001955571466____d0e882>.
    Figure 20 Applied

Click the Events tab. The event list shows that resources of the stack are deployed, as shown in 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.(Figure ECS <en-us_topic_0000001955571466__fig1268133163913> shows the deployed resources on the ECS console for the above example).

Figure 22 ECS

Resources of the stack are deployed.