hashicorp / terraform-provider-awscc

Terraform AWS Cloud Control provider
https://registry.terraform.io/providers/hashicorp/awscc/latest/docs
Mozilla Public License 2.0
240 stars 107 forks source link

awscc_lightsail_database: Database deleted but provider returns an InvalidRequest error on destroy #1818

Open acwwat opened 3 weeks ago

acwwat commented 3 weeks ago

Community Note

Terraform CLI and Terraform AWS Cloud Control Provider Version

Affected Resource(s)

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "awscc_lightsail_database" "example" {
  master_database_name             = "example"
  master_username                  = "admin"
  relational_database_blueprint_id = "mysql_8_0"
  relational_database_bundle_id    = "micro_2_0"
  relational_database_name         = "example-db"
}

Debug Output

2024-06-15T21:51:51.582-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: Received request: @caller=github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/tf6server/server.go:852 tf_proto_version=6.6 tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_resource_type=awscc_lightsail_database tf_rpc=ApplyResourceChange @module=sdk.proto tf_provider_addr=registry.terraform.io/hashicorp/awscc timestamp=2024-06-15T21:51:51.582-0400
2024-06-15T21:51:51.582-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: Sending request downstream: tf_proto_version=6.6 tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_resource_type=awscc_lightsail_database @caller=github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/internal/tf6serverlogging/downstream_request.go:22 @module=sdk.proto tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_rpc=ApplyResourceChange timestamp=2024-06-15T21:51:51.582-0400
2024-06-15T21:51:51.582-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: Checking ResourceTypes lock: @caller=github.com/hashicorp/terraform-plugin-framework@v1.9.0/internal/fwserver/server.go:510 tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_resource_type=awscc_lightsail_database @module=sdk.framework tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_rpc=ApplyResourceChange timestamp=2024-06-15T21:51:51.582-0400
2024-06-15T21:51:51.582-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: ApplyResourceChange received no PlannedState, running DeleteResource: tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 @module=sdk.framework tf_resource_type=awscc_lightsail_database tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-framework@v1.9.0/internal/fwserver/server_applyresourcechange.go:68 timestamp=2024-06-15T21:51:51.582-0400
2024-06-15T21:51:51.582-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: Resource implements ResourceWithConfigure: tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_resource_type=awscc_lightsail_database tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-framework@v1.9.0/internal/fwserver/server_deleteresource.go:45 @module=sdk.framework tf_provider_addr=registry.terraform.io/hashicorp/awscc timestamp=2024-06-15T21:51:51.582-0400
2024-06-15T21:51:51.582-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: Calling provider defined Resource Configure: tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-framework@v1.9.0/internal/fwserver/server_deleteresource.go:52 @module=sdk.framework tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_resource_type=awscc_lightsail_database timestamp=2024-06-15T21:51:51.582-0400
2024-06-15T21:51:51.582-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: Called provider defined Resource Configure: tf_provider_addr=registry.terraform.io/hashicorp/awscc @caller=github.com/hashicorp/terraform-plugin-framework@v1.9.0/internal/fwserver/server_deleteresource.go:54 @module=sdk.framework tf_rpc=ApplyResourceChange tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_resource_type=awscc_lightsail_database timestamp=2024-06-15T21:51:51.582-0400
2024-06-15T21:51:51.582-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: Calling provider defined Resource Delete: tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-framework@v1.9.0/internal/fwserver/server_deleteresource.go:99 @module=sdk.framework tf_resource_type=awscc_lightsail_database timestamp=2024-06-15T21:51:51.582-0400
2024-06-15T21:51:51.582-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: Resource.Delete entry: tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-provider-awscc/internal/generic/logging.go:18 @module=awscc cfn_type=AWS::Lightsail::Database tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_resource_type=awscc_lightsail_database timestamp=2024-06-15T21:51:51.582-0400
2024-06-15T21:51:51.582-0400 [DEBUG] provider.terraform-provider-awscc_v1.2.0_x5.exe: DeleteResource: cfn_type=AWS::Lightsail::Database id=example-db tf_resource_type=awscc_lightsail_database cfTypeName=AWS::Lightsail::Database tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-provider-awscc/internal/service/cloudcontrol/delete.go:18 @module=awscc timestamp=2024-06-15T21:51:51.582-0400
2024-06-15T21:51:51.583-0400 [DEBUG] provider.terraform-provider-awscc_v1.2.0_x5.exe: HTTP Request Sent: http.request.header.x_amz_security_token="*****" http.request.header.x_amz_target=CloudApiService.DeleteResource rpc.system=aws-api tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.53/logging/tf_logger.go:45 http.request.header.amz_sdk_request="attempt=1; max=25" tf_resource_type=awscc_lightsail_database aws.region=us-east-1 tf_aws.sdk=aws-sdk-go-v2 http.request_content_length=118 net.peer.name=cloudcontrolapi.us-east-1.amazonaws.com tf_rpc=ApplyResourceChange @module=awscc http.request.header.x_amz_date=20240616T015151Z http.request.header.amz_sdk_invocation_id=3ee18c20-0c81-49b0-a667-2d667e2a5832 http.url=https://cloudcontrolapi.us-east-1.amazonaws.com/ http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.6.6 (+https://www.terraform.io) terraform-provider-awscc/dev (+https://registry.terraform.io/providers/hashicorp/awscc) aws-sdk-go-v2/1.27.2 os/windows lang/go#1.22.2 md/GOOS#windows md/GOARCH#amd64 api/cloudcontrol#1.18.10" http.request.header.content_type=application/x-amz-json-1.0 cfn_type=AWS::Lightsail::Database
  http.request.body=
  | {"ClientToken":"terraform-20240616015151582700000001","Identifier":"example-db","TypeName":"AWS::Lightsail::Database"}
   http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************NREV/20240616/us-east-1/cloudcontrolapi/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-date;x-amz-security-token;x-amz-target, Signature=*****" tf_aws.signing_region="" http.method=POST rpc.method=DeleteResource rpc.service=CloudControl timestamp=2024-06-15T21:51:51.583-0400
2024-06-15T21:51:51.937-0400 [DEBUG] provider.terraform-provider-awscc_v1.2.0_x5.exe: HTTP Response Received: http.response.header.x_amzn_requestid=4123cf99-44d6-4a44-9af5-c86b80e2775a http.response_content_length=219 http.status_code=200 tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 @module=awscc
  http.response.body=
  | {"ProgressEvent":{"EventTime":1.718502712593E9,"Identifier":"example-db","Operation":"DELETE","OperationStatus":"IN_PROGRESS","RequestToken":"3f10ff6f-29fa-4456-a89b-3acdd02661fe","TypeName":"AWS::Lightsail::Database"}}
   aws.region=us-east-1 http.duration=354 http.response.header.date="Sun, 16 Jun 2024 01:51:52 GMT" tf_resource_type=awscc_lightsail_database tf_rpc=ApplyResourceChange http.response.header.content_type=application/x-amz-json-1.0 tf_provider_addr=registry.terraform.io/hashicorp/awscc cfn_type=AWS::Lightsail::Database rpc.method=DeleteResource rpc.service=CloudControl rpc.system=aws-api tf_aws.sdk=aws-sdk-go-v2 tf_aws.signing_region="" @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.53/logging/tf_logger.go:45 http.response.header.connection=keep-alive timestamp=2024-06-15T21:51:51.937-0400
2024-06-15T21:51:51.938-0400 [DEBUG] provider.terraform-provider-awscc_v1.2.0_x5.exe: HTTP Request Sent: @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.53/logging/tf_logger.go:45 http.request.header.amz_sdk_invocation_id=0a868fc4-9d3e-4479-9bb8-bf7e83a587f3 rpc.system=aws-api tf_resource_type=awscc_lightsail_database http.request.header.x_amz_date=20240616T015151Z http.request.header.x_amz_target=CloudApiService.GetResourceRequestStatus aws.region=us-east-1 rpc.method=GetResourceRequestStatus http.method=POST net.peer.name=cloudcontrolapi.us-east-1.amazonaws.com http.request.header.amz_sdk_request="attempt=1; max=25" http.request.header.x_amz_security_token="*****" http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.6.6 (+https://www.terraform.io) terraform-provider-awscc/dev (+https://registry.terraform.io/providers/hashicorp/awscc) aws-sdk-go-v2/1.27.2 os/windows lang/go#1.22.2 md/GOOS#windows md/GOARCH#amd64 api/cloudcontrol#1.18.10" tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************NREV/20240616/us-east-1/cloudcontrolapi/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-date;x-amz-security-token;x-amz-target, Signature=*****" http.request.header.content_type=application/x-amz-json-1.0 http.url=https://cloudcontrolapi.us-east-1.amazonaws.com/ rpc.service=CloudControl tf_aws.sdk=aws-sdk-go-v2
  http.request.body=
  | {"RequestToken":"3f10ff6f-29fa-4456-a89b-3acdd02661fe"}
   @module=awscc cfn_type=AWS::Lightsail::Database http.request_content_length=55 tf_aws.signing_region="" tf_rpc=ApplyResourceChange timestamp=2024-06-15T21:51:51.937-0400
2024-06-15T21:51:52.029-0400 [DEBUG] provider.terraform-provider-awscc_v1.2.0_x5.exe: HTTP Response Received: @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.53/logging/tf_logger.go:45 http.response.header.content_type=application/x-amz-json-1.0 rpc.method=GetResourceRequestStatus tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_resource_type=awscc_lightsail_database tf_rpc=ApplyResourceChange cfn_type=AWS::Lightsail::Database http.response.header.date="Sun, 16 Jun 2024 01:51:52 GMT" http.response.header.x_amzn_requestid=27b8a01d-c29e-4900-a964-ce8f55e7a471 rpc.service=CloudControl rpc.system=aws-api tf_aws.sdk=aws-sdk-go-v2 tf_aws.signing_region="" aws.region=us-east-1 http.duration=90
  http.response.body=
  | {"ProgressEvent":{"EventTime":1.718502712593E9,"Identifier":"example-db","Operation":"DELETE","OperationStatus":"IN_PROGRESS","RequestToken":"3f10ff6f-29fa-4456-a89b-3acdd02661fe","TypeName":"AWS::Lightsail::Database"}}
   http.response.header.connection=keep-alive http.status_code=200 @module=awscc http.response_content_length=219 timestamp=2024-06-15T21:51:52.029-0400
2024-06-15T21:51:55.662-0400 [TRACE] dag/walk: vertex "root" is waiting for "provider[\"registry.terraform.io/hashicorp/awscc\"] (close)"
2024-06-15T21:51:55.662-0400 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/hashicorp/awscc\"] (close)" is waiting for "awscc_lightsail_database.example (destroy)"
2024-06-15T21:51:57.042-0400 [DEBUG] provider.terraform-provider-awscc_v1.2.0_x5.exe: HTTP Request Sent: cfn_type=AWS::Lightsail::Database http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************NREV/20240616/us-east-1/cloudcontrolapi/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-date;x-amz-security-token;x-amz-target, Signature=*****" http.request.header.content_type=application/x-amz-json-1.0 http.request.header.x_amz_security_token="*****" rpc.service=CloudControl tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 http.request.header.x_amz_date=20240616T015157Z rpc.method=GetResourceRequestStatus tf_rpc=ApplyResourceChange @module=awscc
  http.request.body=
  | {"RequestToken":"3f10ff6f-29fa-4456-a89b-3acdd02661fe"}
   http.request.header.amz_sdk_invocation_id=47301ab7-b2a5-4404-b64a-a3b9f1aba93b http.request.header.amz_sdk_request="attempt=1; max=25" @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.53/logging/tf_logger.go:45 http.request.header.x_amz_target=CloudApiService.GetResourceRequestStatus tf_provider_addr=registry.terraform.io/hashicorp/awscc http.request_content_length=55 http.url=https://cloudcontrolapi.us-east-1.amazonaws.com/ rpc.system=aws-api tf_aws.sdk=aws-sdk-go-v2 aws.region=us-east-1 net.peer.name=cloudcontrolapi.us-east-1.amazonaws.com tf_aws.signing_region="" http.method=POST http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.6.6 (+https://www.terraform.io) terraform-provider-awscc/dev (+https://registry.terraform.io/providers/hashicorp/awscc) aws-sdk-go-v2/1.27.2 os/windows lang/go#1.22.2 md/GOOS#windows md/GOARCH#amd64 api/cloudcontrol#1.18.10" tf_resource_type=awscc_lightsail_database timestamp=2024-06-15T21:51:57.042-0400
2024-06-15T21:51:57.351-0400 [DEBUG] provider.terraform-provider-awscc_v1.2.0_x5.exe: HTTP Response Received: http.duration=308 tf_aws.sdk=aws-sdk-go-v2 tf_aws.signing_region="" @caller=github.com/hashicorp/aws-sdk-go-base/v2@v2.0.0-beta.53/logging/tf_logger.go:45 @module=awscc cfn_type=AWS::Lightsail::Database http.response.header.date="Sun, 16 Jun 2024 01:51:58 GMT" rpc.method=GetResourceRequestStatus rpc.service=CloudControl rpc.system=aws-api tf_provider_addr=registry.terraform.io/hashicorp/awscc
  http.response.body=
  | {"ProgressEvent":{"ErrorCode":"InvalidRequest","EventTime":1.718502714791E9,"Identifier":"example-db","Operation":"DELETE","OperationStatus":"FAILED","RequestToken":"3f10ff6f-29fa-4456-a89b-3acdd02661fe","StatusMessage":"These parameters are required: relationalDatabaseName (Service: Lightsail, Status Code: 400, Request ID: 1e7b42ec-d698-43dd-bc16-1e6f6127b52d)","TypeName":"AWS::Lightsail::Database"}}
   http.response.header.content_type=application/x-amz-json-1.0 tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_resource_type=awscc_lightsail_database tf_rpc=ApplyResourceChange http.response.header.connection=keep-alive http.response.header.x_amzn_requestid=5a887d7b-e3a7-45ec-b2f6-3fe77d2f2113 http.status_code=200 aws.region=us-east-1 http.response_content_length=404 timestamp=2024-06-15T21:51:57.351-0400
2024-06-15T21:51:57.351-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: Called provider defined Resource Delete: tf_resource_type=awscc_lightsail_database tf_rpc=ApplyResourceChange @caller=github.com/hashicorp/terraform-plugin-framework@v1.9.0/internal/fwserver/server_deleteresource.go:101 tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 @module=sdk.framework timestamp=2024-06-15T21:51:57.351-0400
2024-06-15T21:51:57.351-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: Received downstream response: tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 tf_req_duration_ms=5769 tf_rpc=ApplyResourceChange diagnostic_error_count=1 diagnostic_warning_count=0 tf_proto_version=6.6 tf_resource_type=awscc_lightsail_database @caller=github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/internal/tf6serverlogging/downstream_request.go:42 @module=sdk.proto tf_provider_addr=registry.terraform.io/hashicorp/awscc timestamp=2024-06-15T21:51:57.351-0400
2024-06-15T21:51:57.351-0400 [ERROR] provider.terraform-provider-awscc_v1.2.0_x5.exe: Response contains error diagnostic: @caller=github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/internal/diag/diagnostics.go:58 @module=sdk.proto diagnostic_summary="AWS SDK Go Service Operation Unsuccessful" tf_resource_type=awscc_lightsail_database tf_rpc=ApplyResourceChange diagnostic_detail="Calling Cloud Control API service DeleteResource operation returned: waiter state transitioned to FAILED. StatusMessage: These parameters are required: relationalDatabaseName (Service: Lightsail, Status Code: 400, Request ID: 1e7b42ec-d698-43dd-bc16-1e6f6127b52d). ErrorCode: InvalidRequest" tf_proto_version=6.6 diagnostic_severity=ERROR tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 timestamp=2024-06-15T21:51:57.351-0400
2024-06-15T21:51:57.351-0400 [TRACE] provider.terraform-provider-awscc_v1.2.0_x5.exe: Served request: tf_proto_version=6.6 tf_req_id=d8ca5bac-f165-74f0-b472-77561edc2998 @caller=github.com/hashicorp/terraform-plugin-go@v0.23.0/tfprotov6/tf6server/server.go:878 @module=sdk.proto tf_provider_addr=registry.terraform.io/hashicorp/awscc tf_resource_type=awscc_lightsail_database tf_rpc=ApplyResourceChange timestamp=2024-06-15T21:51:57.351-0400
2024-06-15T21:51:57.352-0400 [TRACE] GRPCProvider.v6: GetProviderSchema
2024-06-15T21:51:57.352-0400 [TRACE] GRPCProvider.v6: returning cached schema: EXTRA_VALUE_AT_END=registry.terraform.io/hashicorp/awscc
2024-06-15T21:51:57.352-0400 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState to workingState for awscc_lightsail_database.example
2024-06-15T21:51:57.352-0400 [TRACE] NodeAbstractResouceInstance.writeResourceInstanceState: writing state object for awscc_lightsail_database.example
2024-06-15T21:51:57.352-0400 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old
2024-06-15T21:51:57.352-0400 [TRACE] statemgr.Filesystem: no state changes since last snapshot
2024-06-15T21:51:57.352-0400 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2024-06-15T21:51:57.353-0400 [DEBUG] State storage *statemgr.Filesystem declined to persist a state snapshot
2024-06-15T21:51:57.353-0400 [ERROR] vertex "awscc_lightsail_database.example (destroy)" error: AWS SDK Go Service Operation Unsuccessful
2024-06-15T21:51:57.353-0400 [TRACE] vertex "awscc_lightsail_database.example (destroy)": visit complete, with errors
2024-06-15T21:51:57.353-0400 [TRACE] dag/walk: upstream of "provider[\"registry.terraform.io/hashicorp/awscc\"] (close)" errored, so skipping
2024-06-15T21:51:57.353-0400 [TRACE] dag/walk: upstream of "root" errored, so skipping
2024-06-15T21:51:57.353-0400 [TRACE] statemgr.Filesystem: not making a backup, because the new snapshot is identical to the old
2024-06-15T21:51:57.353-0400 [TRACE] statemgr.Filesystem: no state changes since last snapshot
2024-06-15T21:51:57.353-0400 [TRACE] statemgr.Filesystem: writing snapshot at terraform.tfstate
2024-06-15T21:51:57.354-0400 [TRACE] statemgr.Filesystem: removing lock metadata file .terraform.tfstate.lock.info
2024-06-15T21:51:57.354-0400 [TRACE] statemgr.Filesystem: unlocked by closing terraform.tfstate
2024-06-15T21:51:57.354-0400 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-06-15T21:51:57.370-0400 [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/awscc/1.2.0/windows_amd64/terraform-provider-awscc_v1.2.0_x5.exe pid=21144
2024-06-15T21:51:57.370-0400 [DEBUG] provider: plugin exited

Panic Output

n/a

Expected Behavior

terraform destroy completes successfully and the database is deleted.

Actual Behavior

Terraform destroy fails with the following error, even though the actual database is deleted as verified in the Lightsail console:

> terraform destroy          
awscc_lightsail_database.example: Refreshing state... [id=example-db]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # awscc_lightsail_database.example will be destroyed
  - resource "awscc_lightsail_database" "example" {
      - availability_zone                = "us-east-1a" -> null
      - backup_retention                 = true -> null
      - ca_certificate_identifier        = "rds-ca-rsa2048-g1" -> null
      - database_arn                     = "arn:aws:lightsail:us-east-1:<redacted>:RelationalDatabase/d49b2e91-8098-437b-b065-dd8be50d3bb9" -> null
      - id                               = "example-db" -> null
      - master_database_name             = "example" -> null
      - master_username                  = "admin" -> null
      - preferred_backup_window          = "04:24-04:54" -> null
      - preferred_maintenance_window     = "mon:09:54-mon:10:24" -> null
      - publicly_accessible              = false -> null
      - relational_database_blueprint_id = "mysql_8_0" -> null
      - relational_database_bundle_id    = "micro_2_0" -> null
      - relational_database_name         = "example-db" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

awscc_lightsail_database.example: Destroying... [id=example-db]
╷
│ Error: AWS SDK Go Service Operation Unsuccessful
│
│ Calling Cloud Control API service DeleteResource operation returned: waiter state transitioned to FAILED. StatusMessage: These parameters are required:      
│ relationalDatabaseName (Service: Lightsail, Status Code: 400, Request ID: 1e7b42ec-d698-43dd-bc16-1e6f6127b52d). ErrorCode: InvalidRequest
╵
>

Steps to Reproduce

  1. terraform apply
  2. terraform destroy

Important Factoids

n/a

References

n/a

wellsiau-aws commented 1 week ago

I highly suspect upstream handler issue, expecting ‘ relationalDatabaseName’ to be included in the delete request

wellsiau-aws commented 1 week ago

Confirmed, I tried to use CCAPI CLI to delete the resource in question and I got similar error:

{
    "ProgressEvent": {
        "TypeName": "AWS::Lightsail::Database",
        "Identifier": "example-db",
        "RequestToken": "23852623-cff4-417c-b50d-dc730c34ea22",
        "Operation": "DELETE",
        "OperationStatus": "FAILED",
        "EventTime": "2024-06-28T15:24:08.531000-07:00",
        "StatusMessage": "These parameters are required: relationalDatabaseName (Service: Lightsail, Status Code: 400, Request ID: 6c4777cf-80e9-4ade-8fde-aa24edc76aa2)",
        "ErrorCode": "InvalidRequest"
    }
}
wellsiau-aws commented 1 week ago

@acwwat , thank you for reporting this issue. This appears to be upstream issue in AWS and I have raised internal ticket to address this problem.