ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [Terraform] 외부 모듈 플러그인 오류발생 해결
    오픈소스 2025. 2. 7. 10:23

     

    1. 텐센트 클라우드 테라폼 작업 도중 오류가 발생

      - 잘 사용하고 있던 테라폼 모듈에서 오류가 발생하였다. 방금 전 까지도 작업을 했었는데 갑자기 오류가 발행해서 오류내용을 복사해서 ChatGPT에게 문의했더니 사용자가 작업할 수 있는 내용이 아니라고 한다

     

    ╷
    │ Error: Request cancelled
    │ 
    │   with module.cvhttp://m.tencentcloud_instance.cvm["test-server-01],
    │   on modules/cvm/main.tf line 16, in resource "tencentcloud_instance" "cvm":
    │   16: resource "tencentcloud_instance" "cvm" {
    │ 
    │ The plugin.(*GRPCProvider).UpgradeResourceState request was cancelled.
    ╵
    
    Stack trace from the terraform-provider-tencentcloud_v1.81.161 plugin:
    
    panic: runtime error: index out of range [1] with length 1
    
    goroutine 1275 [running]:
    github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/cvm.resourceTencentCloudInstanceRead(0xc001d25900, {0x64b2380?, 0xc00028e638})
    github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/services/cvm/resource_tc_instance.go:1386 +0x31fe
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).read(0x83f3f30?, {0x83f3f30?, 0xc0011311d0?}, 0xd?, {0x64b2380?, 0xc00028e638?})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.20.0/helper/schema/resource.go:712 +0x178
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).RefreshWithoutUpgrade(0xc000ac7960, {0x83f3f30, 0xc0011311d0}, 0xc000ba5110, {0x64b2380, 0xc00028e638})
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.20.0/helper/schema/resource.go:1015 +0x585
    github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ReadResource(0xc0001261c8, {0x83f3f30?, 0xc0011310b0?}, 0xc0025bd440)
    github.com/hashicorp/terraform-plugin-sdk/v2@v2.20.0/helper/schema/grpc_provider.go:613 +0x497
    github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ReadResource(0xc0003ce0a0, {0x83f3f30?, 0xc001130ae0?}, 0xc001908ba0)
    github.com/hashicorp/terraform-plugin-go@v0.12.0/tfprotov5/tf5server/server.go:747 +0x41e
    github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ReadResource_Handler({0x6d48ae0?, 0xc0003ce0a0}, {0x83f3f30, 0xc001130ae0}, 0xc000380ee0, 0x0)
    github.com/hashicorp/terraform-plugin-go@v0.12.0/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:349 +0x170
    google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000001e0, {0x83f7e30, 0xc000169d40}, 0xc0022fe120, 0xc001111da0, 0xf82fd90, 0x0)
    google.golang.org/grpc@v1.53.0/server.go:1336 +0xd13
    google.golang.org/grpc.(*Server).handleStream(0xc0000001e0, {0x83f7e30, 0xc000169d40}, 0xc0022fe120, 0x0)
    google.golang.org/grpc@v1.53.0/server.go:1704 +0xa1b
    google.golang.org/grpc.(*Server).serveStreams.func1.2()
    google.golang.org/grpc@v1.53.0/server.go:965 +0x98
    created by google.golang.org/grpc.(*Server).serveStreams.func1
    google.golang.org/grpc@v1.53.0/server.go:963 +0x28a
    
    Error: The terraform-provider-tencentcloud_v1.81.161 plugin crashed!
    
    This is always indicative of a bug within the plugin. It would be immensely
    helpful if you could report the crash with the plugin's maintainers so that it
    can be fixed. The output above should help diagnose the issue.

     

    ChatGPT가 오류의 원인과 몇가지 해결 방안을 제시해 주었다.

     

     

    10분 정도 기다렸다가 다시 실행했는데도 동일한 문제가 발생하였다. 코드에서 구성이 잘못되어 있는지를 확인하였지만 코드는 잘 사용하고 있던 것이고 문법 오류가 있는지 확인했지만 발견하지 못했다. 

     

    플러그인을 업그레이드를 해보기로 하였다.

    $ terraform init -upgrade
    Initializing the backend...
    Upgrading modules...
    - cam in modules/cam
    - clb in modules/clb
    - cvm in modules/cvm
    - vpc in modules/vpc
    Initializing provider plugins...
    - Finding tencentcloudstack/tencentcloud versions matching "> 1.18.1, >= 1.81.124"...
    - Installing tencentcloudstack/tencentcloud v1.81.164...
    - Installed tencentcloudstack/tencentcloud v1.81.164

     

    플러그인이 업그레드 이후 다시 plan을 하니 정상적으로 동작하였다.

Copyright 2020. bluewins All Rights Reserved.