tencent cloud

Feedback

Terraform Overview

Last updated: 2023-12-29 16:06:50
    Terraform is an Infrastructure as Code (IaC) tool that allows creation of reusable, maintainable infrastructure code. You can manage and update your infrastructure using codes, thereby simplifying the deployment and management of cloud infrastructure. With abundant resource types, powerful modules, and flexible customization options, Terraform makes it easy to create and manage a variety of resources, such as CVM and CLB.

    Terraform Features and Advantages

    Terraform is a powerful open-source tool for automatically deploying and orchestrating cloud infrastructure.
    Terraform enables you to operate, construct, define, deploy, and preview cloud infrastructure on Tencent Cloud using simple template language commands.
    Terraform is remarkably user-friendly. It uses the simple HCL or JSON configuration language to define infrastructure, requiring virtually no code writing.
    With variables, modules, and data source features, Terraform's configuration files are easy to use, reusable, and maintainable.
    Terraform can provide plan reports at different stages, so users can get to know the actual operations executions.
    Terraform tracks the actual configuration and status information of infrastructure through state files and supports rollback operations.
    Note: For details about the application scenarios of Terraform, see Use Cases.

    Terraform Resources

    In Terraform, resources mainly fall into two categories: Resource and Data Source.
    Resource
    Resource enables the creation and management of new cloud infrastructure components. Through resource definitions, Terraform can be used for creating, modifying, and deleting a diverse range of resources supported by cloud service providers, such as creating a new CVM instance.
    #Resource of cvm chc_assist_vpc.
    # Reference document: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/resources/cvm_chc_assist_vpc
    resource "tencentcloud_cvm_chc_assist_vpc" "chc_assist_vpc" {
    chc_id = "chc-xxxxx"
    }
    Data Source
    A data source is used to access and retrieve information of already existing resources and subsequently implementing it as an input or attribute within the configuration. A data source can be used to retrieve the configuration and attribute information from an existing cloud infrastructure, making it available for reference and usage within a Terraform configuration file. The following example shows that it is used to query an instance of a created cvm chc_denied_actions:
    #Using this data source to extract detailed information from cvm chc_denied_actions.
    # Reference document: https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/data-sources/cvm_chc_denied_actions
    data "tencentcloud_cvm_chc_denied_actions" "chc_denied_actions" {
    chc_ids = ["chc-xxxxx"]
    }
    For information about the Resource of the TCOP Prometheus version, see Usage with Terraform.

    Terraform Tools

    Terraform Command Line Interface (CLI):
    Terraform CLI is a command line interface designed to create, manage, and manage infrastructure. It brings a suite of commands and options, enabling users to perform various operations, including initializing configuration, creating plans, and applying changes. Terraform CLI also incorporates several sub-commands associated with additional Terraform functionality, such as configuration validation and code formatting. Employing Terraform CLI enables users to interact with Terraform configuration files and manage the infrastructure effectively.
    Terraform Provider:
    Each cloud provider provides its proprietary Terraform Provider, which is a plugin used to incorporate the features of the cloud provider into Terraform. Each Terraform Provider is tasked with interacting with the APIs of the corresponding cloud service provider, defining available resources and data sources, and performing operations of creating, modifying, or deleting these resources. By deploying the appropriate provider, you can directly use the resources and features of the cloud provider within Terraform configurations.
    Note:
    The Terraform CLI serves as the command line interface to manage Terraform, while Terraform Provider is the plugin incorporating the features of diverse cloud providers into Terraform. These two components work collaboratively, enabling users to use Terraform to create and manage infrastructure. For more information about Terraform, see the usage document of Terraform.

    Usage Advantages

    Multi-Cloud Solution: Applicable to multi-cloud solutions, Terraform can deploy analogous infrastructure to Tencent Cloud and local data centers. Due to Terraform's portability, developers can manage resources from distinct cloud providers simultaneously using the same tools and configuration files. Such flexibility allows users to switch to other cloud platforms at any time without the need to modify their configuration files.
    Automated Management: Terraform enables the creation of configuration file templates, defining, provisioning, and configuring resources in a repeatable and predictable manner, reducing deployment and management errors due to human factors. Using Terraform allows users to deploy the same template multiple times, creating identical development, test, and production environments. Additionally, Terraform automates the process of creating and managing infrastructure, thereby enhancing deployment speed and efficiency.
    Infrastructure as Code: The Infrastructure as Code (IaC) method of Terraform allows for the management of resources through code, providing convenience in version control, collaboration, and code reuse. Using Terraform, you can save the state of your infrastructure to track system changes and share these configurations with others. This code-based management approach not only simplifies deployment but also ensures consistency, security, and maintainability.
    Visual Interface: Terraform's graphical interface allows for the viewing and management of infrastructure resources. This enables users to view and understand their infrastructures and interdependencies of infrastructures more directly. Through this visual interface, users can locate and rectify potential configuration problems faster and easier.
    Community Support: Developed by HashiCorp, Terraform is backed by a large community. This community comprises professionals across various industries and experience levels capable of sharing best practices and solutions, offering supports like forums and email lists.

    Using TCOP Prometheus Managed Service via Terraform

    Prometheus supports managing the following resources via Terraform:
    Name
    Description
    Prometheus Instances
    Prometheus Alarm Rules
    Prometheus Recording Rules
    Prometheus Cvm Agent
    
    Prometheus cvm_agent Capture Tasks
    Prometheus Integration Center Resources
    
    Prometheus Association with Grafana
    Prometheus Association with Containers
    Prometheus Cluster Collection Configuration
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support