Skip to content

Cannot provision CCN-type Private NAT Gateway via tencentcloud_vpc_private_nat_gateway#4330

Description

@pasanm98

Community Note

Terraform Version

Terraform v1.15.6
+ provider registry.terraform.io/tencentcloudstack/tencentcloud v1.83.13

Affected Resource(s)

  • tencentcloud_vpc_private_nat_gateway

Terraform Configuration Files

terraform {
  required_version = ">= 1.5.0"
  required_providers {
    tencentcloud = {
      source  = "tencentcloudstack/tencentcloud"
      version = ">= 1.81.0"
    }
  }
}

provider "tencentcloud" {
  region = "ap-singapore"
}

resource "tencentcloud_vpc_private_nat_gateway" "test" {
  nat_gateway_name = "tf-s4-vpc-and-ccn"
  vpc_id           = "vpc-6r53my5v"
  ccn_id           = "ccn-emy8y03t"
}

Debug Output

[Insert Link to your Gist Here]

Panic Output

N/A

Expected Behavior

When ccn_id is supplied alongside the required vpc_id, the provider should allow explicit creation of a CCN-type Private NAT Gateway. The CcnId parameter should be propagated to the Tencent Cloud API, and the resulting network type should reflect the CCN architecture.

Alternatively, if an explicit switch is required by the backend API, a network_type selector should be exposed in the Terraform schema.

Actual Behavior

The provider creates a Direct Connect type (DCG) gateway instead of a CCN type. The resulting state object does not persist the CcnId (returns as ""), and the NatType defaults to DCG.

Steps to Reproduce

  1. Initialize Terraform: terraform init

  2. Apply the configuration containing both vpc_id and ccn_id: terraform apply

  3. Verify the created resource attributes using the Tencent Cloud CLI:

tccli vpc DescribePrivateNatGateways --region ap-singapore --Limit 50 | Select-String "tf-s4-vpc-and-ccn|NatGatewayId|NatType|VpcType|CcnId"
  1. Observe the output showing the gateway defaulted to a Direct Connect type:
"NatGatewayId": "intranat-4kgcjv0g",
"NatGatewayName": "tf-s4-vpc-and-ccn",
"NatType": "DCG",
"VpcType": false,
"CcnId": ""

Important Factoids

Tencent Cloud supports three types of Private NAT Gateways: Direct Connect, VPC, and CCN.

  • When applying vpc_id and explicitly passing vpc_type = true, the provider successfully creates a VPC Type gateway.

  • When applying only ccn_id (omitting vpc_id), the API rightfully rejects the request with a MissingParameter: VpcId error, because a host VPC is physically required.

  • When applying both vpc_id and ccn_id, the provider fails to infer the CCN type and quietly defaults to a Direct Connect (DCG) gateway, ignoring the provided ccn_id payload. There is currently no observable override flag (like vpc_type = true) to force a CCN type.

References

Tencent Cloud Private NAT Gateway - Terraform Issue.pdf

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions