Git Product home page Git Product logo

terraform-provider-tencentcloud's Introduction

Terraform logo

Terraform Provider For TencentCloud

stars Forks Go Report Card Releases License Issues

logo
Tencent Infrastructure Automation for Terraform.

Requirements

  • Terraform 0.13.x
  • Go 1.18.x (to build the provider plugin)

Usage

Build from source code

Clone repository to: $GOPATH/src/github.com/tencentcloudstack/terraform-provider-tencentcloud

$ mkdir -p $GOPATH/src/github.com/tencentcloudstack
$ cd $GOPATH/src/github.com/tencentcloudstack
$ git clone https://github.com/tencentcloudstack/terraform-provider-tencentcloud.git
$ cd terraform-provider-tencentcloud
$ go build .

If you're building the provider, follow the instructions to install it as a plugin. After placing it into your plugins directory, run terraform init to initialize it.

Configuration

Configure credentials

You will need to have a pair of secret id and secret key to access Tencent Cloud resources, configure it in the provider arguments or export it in environment variables. If you don't have it yet, please access Tencent Cloud Management Console to create one.

export TENCENTCLOUD_SECRET_ID=AKID9HH4OpqLJ5f6LPr4iIm5GF2s-EXAMPLE
export TENCENTCLOUD_SECRET_KEY=72pQp14tWKUglrnX5RbaNEtN-EXAMPLE

Configure proxy info (optional)

If you are beind a proxy, for example, in a corporate network, you must set the proxy environment variables correctly. For example:

export http_proxy=http://your-proxy-host:your-proxy-port  # This is just an example, use your real proxy settings!
export https_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy

Run demo

You can edit your own terraform configuration files. Learn examples from examples directory.

Now you can try your terraform demo:

terraform init
terraform plan
terraform apply

If you want to destroy the resource, make sure the instance is already in running status, otherwise the destroy might fail.

terraform destroy

Developer Guide

DEBUG

You will need to set an environment variable named TF_LOG, for more info please refer to Terraform official doc:

export TF_LOG=DEBUG

In your source file, import the standard package log and print the message such as:

log.Println("[DEBUG] the message and some import values: %v", importantValues)

Test

The quicker way for development and debug is writing test cases.

Config environment variables:

export TF_ACC=true

Config your appid for COS bucket testing

export TENCENTCLOUD_APPID=1234567890

This example show how to test single test function:

cd tencentcloud
go test -i; go test -test.run TestAccTencentCloudNatGateway_basic -v

To write test cases, check the xxx_test.go files for more reference.

Avoid terraform init

export TF_SKIP_PROVIDER_VERIFY=1

This will disable the verify steps, so after you update this provider, you won't need to create new resources, but use previously saved state.

License

Terraform-Provider-TencentCloud is under the Mozilla Public License 2.0. See the LICENSE file for details.

terraform-provider-tencentcloud's People

Contributors

andrew-tx avatar appilon avatar athom avatar brickzzhang avatar bruceybian avatar cgriggs01 avatar chrisder avatar crab21 avatar cyberhermanwang avatar gailwang avatar gitmkn avatar hellertang avatar himer avatar ivandksun avatar jihaoxin avatar kagashino avatar likexian avatar lyu571 avatar oliverpei avatar piggona avatar rostachen avatar sesede avatar sevenearth avatar sherlock-holo avatar songrgg avatar tongyiming avatar weimengxs avatar xawei avatar yhlooo avatar zqfan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider-tencentcloud's Issues

image query bug

when I write a image query like this:

data "tencentcloud_image" "my_favorate_image" {
image_name_regex = "[c|C]."
}
the result is :
"data.tencentcloud_image.my_favorate_image": {
"type": "tencentcloud_image",
"depends_on": [],
"primary": {
"id": "978916566",
"attributes": {
"id": "978916566",
"image_id": "img-9in0zslb",
"image_name_regex": "[c|C].
"
},
"meta": {},
"tainted": false
},
"deposed": [],
"provider": "provider.tencentcloud"
}

consider support cvm instance raw user data

now user data should input base64 encrypted string, which is not convinent, considering aws implementation user user_data as raw user data input and user_data_64 as encrypted (which is oppoiste to API definition), we should support raw user data input as well

maybe support user_data_file for advanced users?

internet_max_bandwidth_out is ForceNew but it can be changed without reboot the VM in console

当internet_max_bandwidth_out改变时需要ForceNew,重建VM,但是在Console中修改时,对VM并不影响,Terraform中可以支持update 带宽么?

internet_max_bandwidth_out - (Optional, ForceNew) Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bit per second). If this value is not specified, then automatically sets it to 0 Mbps.

[1] https://www.terraform.io/docs/providers/tencentcloud/r/instance.html#internet_max_bandwidth_out

CCN unattachment issue

plugin version: 1.11

Thanks for adding CCN support!

Two issues maybe needed to fix:

  1. documents
    1.1 missing ""
    like
resource tencentcloud_ccn main

should be

resource "tencentcloud_ccn" "main"

1.2 missing id attribute in tencentcloud_ccn resource (https://www.terraform.io/docs/providers/tencentcloud/r/ccn.html#attributes-reference)

  1. ccn unattachement should be "async" action, so a "retry" should be needed to check the status to make sure instances are really unattached, otherwise it will fail when re-creating tencentcloud_ccn_attachment resources.
Error: Error applying plan:

6 error(s) occurred:

* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_eu[2]: 1 error(s) occurred:

* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_eu.2: [TencentCloudSDKError] Code=UnsupportedOperation.CcnAttached, Message=实例 `vpc-9ley7qeh` 已关联云联网。, RequestId=512ab4f8-189f-412d-82df-dad36411b222
* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_cn[0]: 1 error(s) occurred:

* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_cn.0: [TencentCloudSDKError] Code=UnsupportedOperation.CcnAttached, Message=实例 `vpc-oqq3xg74` 已关联云联网。, RequestId=c7c35982-57ec-475b-910b-220e247fb3fc
* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_eu[1]: 1 error(s) occurred:

* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_eu.1: [TencentCloudSDKError] Code=UnsupportedOperation.CcnAttached, Message=实例 `vpc-co7qfpkz` 已关联云联网。, RequestId=84002e68-7cd2-4707-a032-939344263b62
* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_cn[1]: 1 error(s) occurred:

* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_cn.1: [TencentCloudSDKError] Code=UnsupportedOperation.CcnAttached, Message=实例 `vpc-kcei9pl0` 已关联云联网。, RequestId=55d1f3da-dc48-4bc1-a8f6-9b44b6e64237
* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_eu[0]: 1 error(s) occurred:

* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_eu.0: [TencentCloudSDKError] Code=UnsupportedOperation.CcnAttached, Message=实例 `vpc-3sbfh9lx` 已关联云联网。, RequestId=577977fc-b22d-4390-91fe-4c52480eeb18
* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_cn[2]: 1 error(s) occurred:

* tencentcloud_ccn_attachment.tct_ccn_attach_vpc_cn.2: [TencentCloudSDKError] Code=UnsupportedOperation.CcnAttached, Message=实例 `vpc-ebwdztig` 已关联云联网。, RequestId=c9a211a7-7b98-48f8-a382-03fb4b9fa681

EDIT:
looks like retry action is already there:
https://github.com/terraform-providers/terraform-provider-tencentcloud/blob/master/tencentcloud/resource_tc_ccn_attachment.go#L205
but why it is not working?
You can reproduce this by change the resource name, e.g.
change resource "tencentcloud_ccn_attachment" "at1" to resource "tencentcloud_ccn_attachment" "at2" and re-run terraform apply.

EDIT2:
by looking at terraform output, looks resource creation and destruction started at the same time because of name changes, so maybe this is not the issue from provider, ignore this please.

CVM with SPOTPAID return error InvalidInstanceChargeType.OnlySupportedForSpot

When I use terraform to boot spot vm, it get the following error, I can use the same size/image to boot in the same az on console:

Error: [TencentCloudSDKError] Code=InvalidInstanceChargeType.OnlySupportedForSpot, Message=The instance charge type SPOTPAID is only supported for spot user., RequestId=9c115e8d-c9c6-4c26-89c2-8197647c5d9e

instances should be re-created when image_id changes

provider version: 1.12
when image_id changed, instances should be re-created instead of "modify":


  ~ tencentcloud_instance.test_vm_tct_cn[0]
      image_id:                                  "img-mzbr88cf" => "img-axq9idj1"

  ~ tencentcloud_instance.test_vm_tct_cn[1]
      image_id:                                  "img-mzbr88cf" => "img-axq9idj1"

  ~ tencentcloud_instance.test_vm_tct_cn[2]
      image_id:                                  "img-mzbr88cf" => "img-axq9idj1"

  ~ tencentcloud_instance.test_vm_tct_eu[0]
      image_id:                                  "img-o77dd2jn" => "img-pi1pale7"

  ~ tencentcloud_instance.test_vm_tct_eu[1]
      image_id:                                  "img-o77dd2jn" => "img-pi1pale7"

  ~ tencentcloud_instance.test_vm_tct_eu[2]
      image_id:                                  "img-o77dd2jn" => "img-pi1pale7"


Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

tencentcloud_instance.test_vm_tct_cn[0]: Modifying... (ID: ins-1vv9a7er)
  image_id: "img-mzbr88cf" => "img-axq9idj1"
tencentcloud_instance.test_vm_tct_eu[2]: Modifying... (ID: ins-003b1pf2)
  image_id: "img-o77dd2jn" => "img-pi1pale7"
tencentcloud_instance.test_vm_tct_eu[0]: Modifying... (ID: ins-09od6vhg)
  image_id: "img-o77dd2jn" => "img-pi1pale7"
tencentcloud_instance.test_vm_tct_eu[1]: Modifying... (ID: ins-o9wbotcw)
  image_id: "img-o77dd2jn" => "img-pi1pale7"
tencentcloud_instance.test_vm_tct_cn[1]: Modifying... (ID: ins-ac71rjd5)
  image_id: "img-mzbr88cf" => "img-axq9idj1"
tencentcloud_instance.test_vm_tct_cn[2]: Modifying... (ID: ins-7kbqea89)
  image_id: "img-mzbr88cf" => "img-axq9idj1"

使用TerraForm申请腾讯云服务器如何设置自动续费?

tf.json配置文件:

{
    "provider": {
        "tencentcloud": {
            "region": "ap-shanghai",
            "secret_id": "xxxx",
            "secret_key": "xxxxx"
        }
    },
    "resource": {
        "tencentcloud_instance": {
            "test": {
                "allocate_public_ip": "true",
                "availability_zone": "ap-shanghai-2",
                "count": "1",
                "data_disks": [
                    {
                        "data_disk_size": "50",
                        "data_disk_type": "CLOUD_PREMIUM"
                    }
                ],
                "image_id": "img-6ns5om13",
                "instance_charge_type": "PREPAID",
                "instance_charge_type_prepaid_period": 1,
                "instance_name": "test",
                "instance_type": "S2.SMALL1",
                "internet_charge_type": "TRAFFIC_POSTPAID_BY_HOUR",
                "internet_max_bandwidth_out": 200,
                "password": "xxxxxxx",
                "project_id": "xxxxx",
                "security_groups": [
                    "xxxxxx"
                ],
                "system_disk_size": "50",
                "system_disk_type": "CLOUD_PREMIUM"
            }
        }
    }

创建服务器后发现没有自动续费,查看文档后发现了“instance_charge_type_prepaid_renew_flag”这个参数,配置文件加上"instance_charge_type_prepaid_renew_flag : "true"或者"instance_charge_type_prepaid_renew_flag : "enabled""后报错,错误信息:
Error: invalid instance_charge_type_prepaid_period: true
请问如何设置自动续费呢?

CVB tags not working

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Affected Resource(s)

  • tencentcloud_XXXXX

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

Panic Output

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000

VM的数据盘TF中最小为50G,实际最小应该可以是10G

TF provider代码中限制了数据盘大小为50G-16000G,但是腾讯官网console中可以创建10G的磁盘,
云硬盘的容量,规格大小如下:
普通云硬盘:10GB - 16000GB
高性能云硬盘:10GB - 16000GB
SSD 云硬盘:100GB - 16000GB
https://cloud.tencent.com/document/product/362/5744

terraform-provider-tencentcloud/tencentcloud/resource_tc_instance.go
"data_disk_size": {
Type: schema.TypeInt,
Required: true,
ValidateFunc: validateIntegerInRange(50, 16000),
Description: "Size of the system disk. Value range: [50, 16000], and unit is GB.",
},

need a solution to create instance with private ip

Hi,

When define a private ip to instance resource, if the instance is being re-creating, the new instance will be created immediately after previous one was destroyed, it will cause issue because the private IP may need a short time to be released, so there will be error message like "vpc ip is in use", please help to guide a solution or workaround, thanks.

Don't require both instance type AND cpu / mem

from @balboah :

When specifying an tencentcloud_container_cluster_instance resource, you can set the instance_type.
This per definition also defines which CPU and RAM resources the instance will have, it should not be required to also specify that as an attribute.

Also when specified like cpu = 4 and instance_type = I2.LARGE16, it will result in terraform detecting a change since the api will return a new value of cpu = 3920 at next apply.

Support instance_charge_type for TKE worker

Now in both tencentcloud_kubernetes_cluster and tencentcloud_kubernetes_scale_worker, the worker instance_charge_type is hardcode with POSTPAID_BY_HOUR.

Is there any plan to add instance_charge_type as configurable option, support both POSTPAID_BY_HOUR and PREPAID, to keep consistence with web console?

issue with creating and destroying CBS

By @lubars:

Upgraded Terraform and Tencentcloud plugin:

Terraform v0.12.5

  • provider.null v2.1.2
  • provider.tencentcloud v1.14.0

Still getting internal errors on roughly 25% of calls to terraform apply (this succeeded on the third try):

Error: [TencentCloudSDKError] Code=InternalError, Message=(bd6d22a359eb)An internal error has occurred. Retry your request, but if the problem persists, contact us with details by posting a message on the Tencent cloud forums., RequestId=5498c37c-ff95-4231-ab6c-bd6d22a359eb

on infrastructure.tf line 372, in resource "tencentcloud_cbs_storage" "data":
372: resource "tencentcloud_cbs_storage" "data" {

Still seeing errors on calls to terraform destroy as well:

Error: [TencentCloudSDKError] Code=ResourceBusy, Message=656e6c70-be4a-4657-aed1-95964abc0b7b,ins-ruv3rbzm is busy, please retry later (0afe54a64aa6), RequestId=a7e786f4-5c73-47e6-8d37-0afe54a64aa6

from: https://github.com/terraform-providers/terraform-provider-tencentcloud/issues/18#issuecomment-516985527

[Bug] Failed to run terraform destroy in the first time when you have vms with sshkey

I get issue when I run terraform destroy, in the case I have two vms with sshkey.

Terraform Version

# terraform -v
Terraform v0.12.13
+ provider.tencentcloud v1.22.0

Affected Resource(s)

  • tencentcloud_key_pair

Terraform Configuration Files

create two CVM with sshkey, then run terraform destroy

Expected Behavior

Destroy success.

Actual Behavior

CVM can be destroy, but sshkey destroy failed with the following error:

Error: [TencentCloudSDKError] Code=InvalidInstanceId.NotFound, Message=The specified instance ID `['ins-imyqycsv', 'ins-2o89fojz']` is not found., RequestId=457cd512-2d34-45e9-99df-376c67f9ad8b

if you run terraform destroy again, it can success.

Steps to Reproduce

Write a tf which create 2 CVM with sshkey, then terraform apply, terraform destroy can 100% reproduce this issue.

There is work around which can avoid this issue with limit parallelism to 1 when destroy.

The issue seems like when the code in destroy key pair try to unbind with CVM, but the VM has been deleted. Seems like something wrong here:
https://github.com/terraform-providers/terraform-provider-tencentcloud/blob/master/tencentcloud/resource_tc_key_pair.go#L185-L196

tencentcloud_instance got error, code:SubnetNotExist, message:The creation failed: the subnet [`**`] you specified does not exist

env:
Terraform v0.12.6

  • provider.tencentcloud v1.15.2
    issue:
    terrafrom plan is ok ,but terraform apply has an error.

code:

resource "tencentcloud_instance" "http_proxy" {
  instance_name     = "http-proxy-test"
  availability_zone = "${data.tencentcloud_availability_zones.shanghai_3.name}"
  instance_type     = "${data.tencentcloud_instance_types.http-proxy.instance_types.0.instance_type}"
  image_id          = "${data.tencentcloud_image.default_image.image_id}"
  project_id        = 0

  security_groups = ["${data.tencentcloud_security_groups.httpproxy.security_group_id}"]

  vpc_id    = "${data.tencentcloud_vpc_instances.ivankaprod.vpc_id}"
  subnet_id = "${data.tencentcloud_vpc_subnets.nonat_sh3.subnet_id}"
  internet_max_bandwidth_out = 100
  count                      = 1
  system_disk_size           = 50
  system_disk_type           = "CLOUD_BASIC"
  allocate_public_ip         = true
  instance_charge_type       = "PREPAID"
  instance_charge_type_prepaid_period = 1
}

Issues on GitHub are intended to be related to bugs or feature requests with provider codebase,
so we recommend using our other community resources instead of asking here 👍.


If you have a support request or question please submit them to one of these resources:

Supplementary provider documentation

Community Note

The parameter instance_charge_type_prepaid_renew_flag describes not detailed

Description

New or Affected Resource(s)

  • TerraForm 0.12.6

Potential Terraform Configuration

instance_charge_type_prepaid_renew_flag - (Optional) When enabled, the CVM instance will be renew automatically when it reach the end of the prepaid tenancy, Valid values are NOTIFY_AND_AUTO_RENEW, NOTIFY_AND_MANUAL_RENEW,DISABLE_NOTIFY_AND_MANUAL_RENEW NOTE: it only works when instance_charge_type is set to PREPAID,if the parameter is specified as NOTIFY_AND_AUTO_RENEW, if the account balance is sufficient, the instance will be automatically renewed on a monthly basis after the instance expires.

References

crash while using tencent provider

Crash log here: https://gist.github.com/memory/ffa2fb7b66fc10b0e92240f63d5975ea

Config we were attempting to apply:

provider "tencentcloud" {
  region     = "na-ashburn"
}

resource "tencentcloud_vpc" "virginia" {
  name       = "virginia vpc"
  cidr_block = "10.0.0.0/16"
}

resource "tencentcloud_route_table" "virginia" {
  name   = "virginia route table"
  vpc_id = "${tencentcloud_vpc.virginia.id}"
}

resource "tencentcloud_subnet" "virginia-a" {
  name              = "virginia A subnet"
  cidr_block        = "10.0.1.0/24"
  availability_zone = "na-ashburn-1"
  vpc_id            = "${tencentcloud_vpc.virginia.id}"
  route_table_id    = "${tencentcloud_route_table.virginia.id}"
}

data "tencentcloud_image" "main" {
  os_name = "ubuntu"

  filter {
    name   = "image-type"
    values = ["PUBLIC_IMAGE"]
  }
}

data "tencentcloud_availability_zones" "main" {}

resource "tencentcloud_security_group" "proxy" {
  name        = "squid proxies"
  description = "security group for squids"
}
resource "tencentcloud_security_group_rule" "web" {
  security_group_id = "${tencentcloud_security_group.proxy.id}"
  type              = "ingress"
  cidr_ip           = "0.0.0.0/0"
  ip_protocol       = "tcp"
  port_range        = "433"
  policy            = "accept"
}
resource "tencentcloud_security_group_rule" "ssh" {
  security_group_id = "${tencentcloud_security_group.proxy.id}"
  type              = "ingress"
  cidr_ip           = "172.254.230.94/32"
  ip_protocol       = "tcp"
  port_range        = "22"
  policy            = "accept"
}

resource "tencentcloud_instance" "squid" {
  instance_name     = "squid"
  availability_zone = "${data.tencentcloud_availability_zones.main.zones.0.name}"
  image_id          = "${data.tencentcloud_image.main.image_id}"
  instance_type     = "s2.small1"
  key_name          = "skey-fzp930db"

  security_groups = [
    "${tencentcloud_security_group.proxy.id}",
  ]

  vpc_id    = "${tencentcloud_vpc.virginia.id}"
  subnet_id = "${tencentcloud_subnet.virginia-a.id}"

  internet_max_bandwidth_out = 20
  count                      = 1
}

allocate_public_ip invalid in tencentcloud_instance

provider version: 1.11

no matter true or false of allocate_public_ip defined in tencentcloud_instance, after instance created, and execute terraform apply again, it will update allocate_public_ip: "true" => "false", and it cannot be updated.

  ~ tencentcloud_instance.test
      allocate_public_ip: "true" => "false"
* tencentcloud_instance.test: 1 error(s) occurred:

* tencentcloud_instance.test: tencentcloud_instance update on allocate_public_ip is not supported yet

Additional information: my instance has eip associated after created, I'm not sure if provider detected this as public_ip?

[PROPOSAL] Switch to Go Modules

As part of the preparation for Terraform v0.12, we would like to migrate all providers to use Go Modules. We plan to continue checking dependencies into vendor/ to remain compatible with existing tooling/CI for a period of time, however go modules will be used for management. Go Modules is the official solution for the go programming language, we understand some providers might not want this change yet, however we encourage providers to begin looking towards the switch as this is how we will be managing all Go projects in the future. Would maintainers please react with 👍 for support, or 👎 if you wish to have this provider omitted from the first wave of pull requests. If your provider is in support, we would ask that you avoid merging any pull requests that mutate the dependencies while the Go Modules PR is open (in fact a total codefreeze would be even more helpful), otherwise we will need to close that PR and re-run go mod init. Once merged, dependencies can be added or updated as follows:

$ GO111MODULE=on go get github.com/some/module@master
$ GO111MODULE=on go mod tidy
$ GO111MODULE=on go mod vendor

GO111MODULE=on might be unnecessary depending on your environment, this example will fetch a module @ master and record it in your project's go.mod and go.sum files. It's a good idea to tidy up afterward and then copy the dependencies into vendor/. To remove dependencies from your project, simply remove all usage from your codebase and run:

$ GO111MODULE=on go mody tidy
$ GO111MODULE=on go mod vendor

Thank you sincerely for all your time, contributions, and cooperation!

suggest to increase timeout when creating instance

provider version: 1.12

We experience this issue 2~3 times in Frankfurt, timeout of creating instance is now 1 minute, which is too short, this will lead problems:
Sometimes instances in Frankfurt take more than 1 minute to be created, the final status is successful (from UI),
But,
Terraform reports timeout error at 1 minute, which means, resource tencentcloud_instance.test_vm_xxx below will be NULL in terraform state, so next time people run terraform apply, it will try to create these instances again, but actually these instances are already there.
So, I suggest to increase the timeout to 5 minutes or a better value you think.

tencentcloud_instance.test_vm_eu.2: Still creating... (1m10s elapsed)
tencentcloud_instance.test_vm_eu.0: Still creating... (1m10s elapsed)
tencentcloud_instance.test_vm_eu.1: Still creating... (1m10s elapsed)
tencentcloud_instance.test_vm_eu.2: Still creating... (1m20s elapsed)
tencentcloud_instance.test_vm_eu.0: Still creating... (1m20s elapsed)
tencentcloud_instance.test_vm_eu.1: Still creating... (1m20s elapsed)

Error: Error applying plan:

3 error(s) occurred:

* tencentcloud_instance.test_vm_eu[2]: 1 error(s) occurred:

* tencentcloud_instance.test_vm_eu.2: timeout while waiting for state to become 'success' (timeout: 1m0s)
* tencentcloud_instance.test_vm_eu[0]: 1 error(s) occurred:

* tencentcloud_instance.test_vm_eu.0: timeout while waiting for state to become 'success' (timeout: 1m0s)
* tencentcloud_instance.test_vm_eu[1]: 1 error(s) occurred:

* tencentcloud_instance.test_vm_eu.1: timeout while waiting for state to become 'success' (timeout: 1m0s)

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

[Question] Best Practice to use terraform rotate VMs in Tencent Cloud

背景:
想要使用Terraform在腾讯云实现虚拟机级别“不可变基础设施”的想法,场景如下:
当需要升级应用时,创建新的VM,部署新的APP,将流量切换到新的VM,确认没有问题后,删除老的VM。

使用Terraform本身可以实现,但是这样就无法享受到腾讯云包月的优惠(删除老的包月VM,就基本按照按需收费了)。腾讯云目前如果不支持类似AWS的RI灵活计费,或者类似阿里云的RI实例券 [1], 这种情况下使用Terraform频繁增删变更VM就变的非常尴尬,这种情况下仅能使用按需计费。

腾讯云目前是否有什么best practice支持Terraform使用这种case?
是否有计划支持灵活计费?

[1] https://www.jianshu.com/p/46a5d4b14311

documentation for tencentcloud_clb_listener_rule / health_check_httpd_code unclear

The documentation for tencentcloud_clb_listener_rule attribute health_check_httpd_code is unclear:

health_check_http_code - (Optional) HTTP Status Code. The default is 31 and value range is 1-31. '0b0001' means the return value '1xx' is health. '0b0010' means the return value '2xx' is health. '0b0100' means the return value '3xx' is health. '0b1000' means the return value '4xx' is health. 0b10000 means the return value '5xx' is health. If you want multiple return codes to indicate health, need to add the corresponding values. NOTES: The 'HTTP' health check of the 'TCP' listener only supports specifying one health check status code. NOTES: Only supports listeners of 'HTTP' and 'HTTPS' protocol.

  1. I get errors using "0b0010" or 0b0010; can I just use "2"?
  2. The example at the top of the page, "http_1xx", appears to be invalid:

Error: Incorrect attribute value type

on ../../ICM/etc/Terraform/Tencent/Instance/infrastructure.tf line 500, in resource "tencentcloud_clb_listener_rule" "default":
500: health_check_http_code = "http_1xx"

Inappropriate value for attribute "health_check_http_code": a number is
required.

Create cam_user_policy_attachment cannot complete successfully

Issue Summary

When creating user_policy_attachment, the attachment is created indeed, but terraform doesn't exist correctly, and the attachment state is not refreshed correctly.

Terraform Version

v0.12.13

Affected Resource(s)

  • tencentcloud_cam_user_policy_attachment

Terraform Configuration Files

This is just copied from the unit test.

provider "tencentcloud" {}

resource "tencentcloud_cam_user" "test_user" {
  name                = "test-user"
  remark              = "test"
  console_login       = true
  use_api             = true
  need_reset_password = true
  password            = "Gail@1234"
  phone_num           = "13631555963"
  country_code        = "86"
  email               = "[email protected]"
}
resource "tencentcloud_cam_policy" "test-policy" {
  name        = "test-policy"
  document    = "{\"version\":\"2.0\",\"statement\":[{\"action\":[\"name/sts:AssumeRole\"],\"effect\":\"allow\",\"resource\":[\"*\"]}]}"
  description = "test"
}
resource "tencentcloud_cam_user_policy_attachment" "user_policy_attachment_basic" {
  user_id   = "${tencentcloud_cam_user.test_user.id}"
  policy_id = "${tencentcloud_cam_policy.test-policy.id}"
}

Debug Output

[TencentCloudSDKError] Code=ClientError.ParseJsonError, Message=Fail to parse json content: {"Response":{"List":[{"PolicyId":28234817,"PolicyName":"osp-cos-cn-qa-readonly-access","AddTime":"2019-11-12 18:24:09","CreateMode":2,"Remark":"Data read access for OSP COS bucket.","OperateOwnerUin":"100009609937","OperateUin":"100009675879","OperateUinType":0,"PolicyType":""},{"PolicyId":28230226,"PolicyName":"rsp-cos-cn-qa-readwrite-access","AddTime":"2019-11-12 16:41:29","CreateMode":2,"Remark":"Data read write access for RSP COS bucket.","OperateOwnerUin":"100009609937","OperateUin":"100009675879","OperateUinType":0,"PolicyType":""}],"TotalNum":2,"RequestId":"54083b98-a843-4a33-9452-0b919d9b83ba"}}, because: json: cannot unmarshal string into Go struct field AttachPolicyInfo.Response.List.OperateOwnerUin of type uint64, RequestId=

Expected Behavior

user_policy_attachment being created and state being refreshed.

Actual Behavior

user_policy_attachment is created, but not exit normally and the user_policy_attachment is not

Steps to Reproduce

  1. terraform apply

Important Factoids

References

Not sure if it is because the OperateOwnerUin is string in http response, and it is expected to put in a unit64 field.

unable to create multiple data disks during instance creation

Because of problems with resource tencentcloud_cbs_storage (see issue #2), I tried instead using an array of data disks, and got the following error:

* tencentcloud_instance.default: tencentcloud_instance currently only one data disk is supported during instance creation

In the Tencent console however, I am able to create up to eight data disks during instance creation.

Example:

resource "tencentcloud_instance" "default" {
. . .
  data_disks = [
    {
      data_disk_type = "CLOUD_BASIC""
      data_disk_size = "60"
    },
    {
      data_disk_type = "CLOUD_BASIC""
      data_disk_size = "60"
    }
  ]
. . .
}

internal errors with increasing number of security group rules

With 16 or more tencentcloud_security_group_rule defined, all attempts at apply result in the following error:

Error: Error applying plan:
1 error(s) occurred:
* tencentcloud_instance.default: 1 error(s) occurred:
* tencentcloud_instance.default: tencentcloud_instance got error, code:InternalError, message:An internal error has occurred. Retry your request, but if the problem persists, contact us with details by posting a message on the Tencent cloud forums.

This limit includes inactive rules with count = 0.

tencentcloud_eip_association issue when instances were deleted

When instances were deleted manually, tencentcloud_eip_association will try to unbind a non-existing instances id from eip, so it will stuck till timeout, any solutions?

tencentcloud_eip_association.eip_tct_eu_assoc.2: Still destroying... (ID: eip-h6zvvaaq::ins-bnc8fsck, 50s elapsed)
tencentcloud_eip_association.eip_tct_eu_assoc.1: Still destroying... (ID: eip-m41t20x6::ins-4z5p73pk, 50s elapsed)
tencentcloud_eip_association.eip_tct_eu_assoc.0: Still destroying... (ID: eip-bhhoetfu::ins-gvytdt64, 50s elapsed)
tencentcloud_eip_association.eip_tct_cn_assoc.2: Still destroying... (ID: eip-7o6tunrb::ins-leqq7pop, 50s elapsed)
tencentcloud_eip_association.eip_tct_cn_assoc.1: Still destroying... (ID: eip-8ubh5hu5::ins-o8fpgoyp, 50s elapsed)
tencentcloud_eip_association.eip_tct_cn_assoc.0: Still destroying... (ID: eip-5x30nf2d::ins-ijieuuht, 50s elapsed)
tencentcloud_eip_association.eip_tct_eu_assoc.2: Still destroying... (ID: eip-h6zvvaaq::ins-bnc8fsck, 1m0s elapsed)
tencentcloud_eip_association.eip_tct_eu_assoc.1: Still destroying... (ID: eip-m41t20x6::ins-4z5p73pk, 1m0s elapsed)
tencentcloud_eip_association.eip_tct_eu_assoc.0: Still destroying... (ID: eip-bhhoetfu::ins-gvytdt64, 1m0s elapsed)
tencentcloud_eip_association.eip_tct_cn_assoc.2: Still destroying... (ID: eip-7o6tunrb::ins-leqq7pop, 1m0s elapsed)
tencentcloud_eip_association.eip_tct_cn_assoc.1: Still destroying... (ID: eip-8ubh5hu5::ins-o8fpgoyp, 1m0s elapsed)
tencentcloud_eip_association.eip_tct_cn_assoc.0: Still destroying... (ID: eip-5x30nf2d::ins-ijieuuht, 1m0s elapsed)

......

Error: Error applying plan:

6 error(s) occurred:

* tencentcloud_eip_association.eip_tct_cn_assoc[1] (destroy): 1 error(s) occurred:

* tencentcloud_eip_association.eip_tct_cn_assoc.1: eip still unbinding
* tencentcloud_eip_association.eip_tct_cn_assoc[0] (destroy): 1 error(s) occurred:

* tencentcloud_eip_association.eip_tct_cn_assoc.0: eip still unbinding
* tencentcloud_eip_association.eip_tct_eu_assoc[2] (destroy): 1 error(s) occurred:

* tencentcloud_eip_association.eip_tct_eu_assoc.2: eip still unbinding
* tencentcloud_eip_association.eip_tct_cn_assoc[2] (destroy): 1 error(s) occurred:

* tencentcloud_eip_association.eip_tct_cn_assoc.2: eip still unbinding
* tencentcloud_eip_association.eip_tct_eu_assoc[1] (destroy): 1 error(s) occurred:

* tencentcloud_eip_association.eip_tct_eu_assoc.1: eip still unbinding
* tencentcloud_eip_association.eip_tct_eu_assoc[0] (destroy): 1 error(s) occurred:

* tencentcloud_eip_association.eip_tct_eu_assoc.0: eip still unbinding

unmarshal string into Go struct field .code of type int

I got this error when creating security group resource using terraform plugin

tencentcloud_security_group.alauda_int_group: json: cannot unmarshal string into Go struct field .code of type int
resource "tencentcloud_security_group" "alauda_int_group" {
  name        = "web accessibility"
  description = "make it accessable for both production and stage ports"
}

It seems that I don't have access to creating security group

tencentcloud_eip_association should check bind status?

provider version: 1.11
issue:
tencentcloud_eip_association completed successfully but actually eip was not bind to instance.

tencentcloud_eip_association.test: Creation complete after 4s (ID: eip-m41t20x6::ins-g1y9urdw)

UI:
eiperror

Should "create" function check bind status after bind request submitted in https://github.com/terraform-providers/terraform-provider-tencentcloud/blob/master/tencentcloud/resource_tc_eip_association.go#L83-L96? It should be async action.

provisioning of data disks is not re-entrant

While attempting to reprovision (due to #18), the following error was seen:

* tencentcloud_instance.default.1: tencentcloud_instance update on data_disks is not supported yet

The only way to get past this error once it's appeared is to destroy and re-apply from scratch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.