Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to delete tencentcloud_instance and tencentcloud_key_pair in one single operation #375

Closed
jianzhiteh opened this issue Apr 7, 2020 · 2 comments
Assignees

Comments

@jianzhiteh
Copy link

jianzhiteh commented Apr 7, 2020

Terraform Version

Terraform v0.12.24
+ provider.tencentcloud v1.31.0

Affected Resource(s)

  • tencentcloud_instance
  • tencentcloud_key_pair

Terraform Configuration Files

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

data "tencentcloud_images" "centos_image" {
  image_type = ["PUBLIC_IMAGE"]
  os_name    = "centos"
}

resource "tencentcloud_key_pair" "ssh_key" {
  key_name   = "qcloud_ssh_key"
  public_key = "ssh-rsa sensitive_data_here"
}

# CVM
resource "tencentcloud_instance" "instance" {
  availability_zone          = "ap-hongkong-1"
  allocate_public_ip         = true
  instance_name              = "instance"
  image_id                   = data.tencentcloud_images.centos_image.images[0].image_id
  instance_type              = "S2.MEDIUM4"
  system_disk_type           = "CLOUD_PREMIUM"
  count                      = 1
  instance_charge_type       = "POSTPAID_BY_HOUR"
  internet_charge_type       = "TRAFFIC_POSTPAID_BY_HOUR"
  internet_max_bandwidth_out = 10
  key_name                   = tencentcloud_key_pair.ssh_key.id
}

Debug Output

https://gist.github.com/jianzhiteh/cca1af6ce26154bf0d5e383b0ffaa7c0

Expected Behavior

TencentCloud provider should allow deletion of Cloud VM and Key Pair in one single operation.

Actual Behavior

Error occurs when trying to destroy resources containing CVM and key pair.

Error: [TencentCloudSDKError] Code=InvalidParameterValue.KeyPairNotSupported, Message=The request does not support the key pair `skey-dzr26iy9` which associastes with instance., RequestId=02059bbc-6bad-4d97-8743-da66a0f36c56

Steps to Reproduce

  1. terraform apply
  2. terraform destroy
@oliverpei
Copy link
Contributor

Hi @jianzhiteh , this has been fixed in release 1.31.1, please have a try.

@jianzhiteh
Copy link
Author

@oliverpei Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants