provider.tf
file in the user directory with the following content. Replace my-secret-id
and my-secret-key
with your SecretId and SecretKey, respectively.provider "tencentcloud" {secret_id = "my-secret-id"secret_key = "my-secret-key"}
YOUR_SECRET_ID
and YOUR_SECRET_KEY
with your SecretId and SecretKey, respectively.export TENCENTCLOUD_SECRET_ID=YOUR_SECRET_IDexport TENCENTCLOUD_SECRET_KEY=YOUR_SECRET_KEY
#Specifying Provider Configuration Informationterraform { required_providers { tencentcloud = { source = "tencentcloudstack/tencentcloud" } } }#Prometheus Managing Cloud Monitoring Integration#Prometheus Management of Container Clusters (Collection Containers)resource "tencentcloud_monitor_tmp_tke_cluster_agent" "foo" {instance_id = tencentcloud_monitor_tmp_instance.foo.idagents {region = "ap-mumbai"cluster_type = "eks"cluster_id = "cls-1uary7z2" #ID of the cluster that needs to be associatedenable_external = false}}
terraform init
Initializing the backend...Initializing provider plugins...- Reusing previous version of tencentcloudstack/tencentcloud from the dependency lock file- Using previously-installed tencentcloudstack/tencentcloud v1.81.32Terraform has been successfully initialized!You may now begin working with Terraform. Try running "terraform plan" to seeany changes that are required for your infrastructure. All Terraform commandsshould now work.If you ever set or change modules or backend configuration for Terraform,rerun this command to reinitialize your working directory. If you forget, othercommands will detect it and remind you to do so if necessary.
terraform plan
tencentcloud_monitor_tmp_instance.foo: Refreshing state... [id=prom-jh0zntj2]tencentcloud_monitor_tmp_exporter_integration.tmpExporterIntegration: Refreshing state... [id=balck-box-tf-test#prom-jh0zntj2#1##blackbox-exporter]tencentcloud_monitor_tmp_exporter_integration.tmpExporterMointor: Refreshing state... [id=tf-test-cjtest#prom-jh0zntj2#1##qcloud-exporter]Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with thefollowing symbols:+ createTerraform will perform the following actions:# tencentcloud_monitor_tmp_tke_cluster_agent.foo will be created+ resource "tencentcloud_monitor_tmp_tke_cluster_agent" "foo" {+ id = (known after apply)+ instance_id = "prom-jh0zntj2"+ agents {+ cluster_id = "cls-1uary7z2"+ cluster_name = (known after apply)+ cluster_type = "eks"+ enable_external = false+ region = "ap-mumbai"+ status = (known after apply)}}Plan: 1 to add, 0 to change, 0 to destroy.───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────Note: You didn't use the -out option to save this plan, so Terraform can't guarantee to take exactly these actions ifyou run "terraform apply" now.
terraform apply
tencentcloud_monitor_tmp_instance.foo: Refreshing state... [id=prom-jh0zntj2]tencentcloud_monitor_tmp_exporter_integration.tmpExporterIntegration: Refreshing state... [id=balck-box-tf-test#prom-jh0zntj2#1##blackbox-exporter]tencentcloud_monitor_tmp_exporter_integration.tmpExporterMointor: Refreshing state... [id=tf-test-cjtest#prom-jh0zntj2#1##qcloud-exporter]Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with thefollowing symbols:+ createTerraform will perform the following actions:# tencentcloud_monitor_tmp_tke_cluster_agent.foo will be created+ resource "tencentcloud_monitor_tmp_tke_cluster_agent" "foo" {+ id = (known after apply)+ instance_id = "prom-jh0zntj2"+ agents {+ cluster_id = "cls-1uary7z2"+ cluster_name = (known after apply)+ cluster_type = "eks"+ enable_external = false+ region = "ap-mumbai"+ status = (known after apply)}}Plan: 1 to add, 0 to change, 0 to destroy.Do you want to perform these actions?Terraform will perform the actions described above.Only 'yes' will be accepted to approve.Enter a value: yestencentcloud_monitor_tmp_tke_cluster_agent.foo: Creating...Instance content...Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
terraform destroy
tencentcloud_monitor_tmp_instance.foo: Refreshing state... [id=prom-8dyb6iny]Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with thefollowing symbols:- destroyTerraform will perform the following actions:Instance content...Plan: 0 to add, 0 to change, 1 to destroy.Do you really want to destroy all resources?Terraform will destroy all your managed infrastructure, as shown above.There is no undo. Only 'yes' will be accepted to confirm.Enter a value: yestencentcloud_monitor_tmp_instance.foo: Destroying... [id=prom-8dyb6iny]tencentcloud_monitor_tmp_instance.foo: Destruction complete after 6sDestroy complete! Resources: 1 destroyed.
Destroy complete! Resources: (numbers of existing instances) destroyed.
is displayed, the instance has been deleted.
Was this page helpful?