Skip to content

fix: three TencentCloud plugin bugs - #165

Open
susunola wants to merge 1 commit into
hashicorp:mainfrom
susunola:fix/tencentcloud-bugs
Open

fix: three TencentCloud plugin bugs#165
susunola wants to merge 1 commit into
hashicorp:mainfrom
susunola:fix/tencentcloud-bugs

Conversation

@susunola

Copy link
Copy Markdown

Summary

This PR fixes three outstanding bugs in the TencentCloud plugin.

1. Fix credential parsing crash (closes #147)

The plugin panics when tccli auth login generates credential files with non-string values (e.g., float64 expiresAt, nested oauth object). All bare .(string) type assertions in access_config.go are replaced with safe ok-checked versions.

Before: v.(string)panic
After: v, ok := v.(string) → gracefully skip non-string values

2. Fix duplicate key pair in parallel builds (closes #136)

uuid.TimeOrderedUUID()[:8] only captures the timestamp low 32 bits. Two builds started at the same second will generate colliding key pair names → InvalidKeyPairName.Duplicate.

Fix: Use 18 hex chars (time_low + time_mid + time_hi_and_version + first byte of clock_seq) instead of 8. The clock_seq portion is unique per UUID generation call, so even builds at the exact same timestamp never collide. Total name length remains within Tencent Cloud key pair name limit.

3. Add CLOUD_BSSD and CLOUD_HSSD disk types (closes #132, closes #133)

These disk types are required by newer instance families (e.g., SA5). Without them, Packer rejects valid configurations with specified disk_type is invalid.

Testing

  • go build ./...
  • go test ./... ✓ (all existing tests pass)

@susunola
susunola requested a review from a team as a code owner August 11, 2026 04:49
@hashicorp-cla-app

hashicorp-cla-app Bot commented Aug 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

1. Fix credential parsing crash (hashicorp#147): Handle non-string values in
   tccli OAuth credential files (e.g. float64 expiresAt, nested oauth
   object) by using safe type assertions instead of bare .(string) casts.

2. Fix duplicate key pair in parallel builds (hashicorp#136): Use 18 chars of
   UUID without dashes instead of just 8 timestamp-only chars. This
   includes the clock_seq portion which is unique per build even when
   started at the same timestamp, preventing InvalidKeyPairName.Duplicate.

3. Add CLOUD_BSSD and CLOUD_HSSD disk types (hashicorp#132): These disk types
   are required by newer instance families like SA5. Without them,
   Packer rejects valid configurations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant