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

Cannot destroy aws_db_proxy_target: InvalidParameterCombination error #22052

Open
seanfdnn opened this issue Dec 5, 2021 · 2 comments
Open
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.

Comments

@seanfdnn
Copy link

seanfdnn commented Dec 5, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.15.0
on linux_amd64
+ provider registry.terraform.io/hashicorp/archive v2.2.0
+ provider registry.terraform.io/hashicorp/aws v3.66.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/template v2.2.0

Affected Resource(s)

  • aws_db_proxy_target

Terraform Configuration Files

resource "aws_db_proxy" "this" {
  name                   = module.db_proxy_label.id
  debug_logging          = false
  engine_family          = "POSTGRESQL"
  idle_client_timeout    = 1800
  require_tls            = true
  role_arn               = aws_iam_role.role_for_db_proxy.arn
  vpc_security_group_ids = [aws_security_group.db_clients.id]
  vpc_subnet_ids         = data.aws_db_subnet_group.this.subnet_ids

  auth {
    auth_scheme = "SECRETS"
    description = module.db_proxy_label.id
    iam_auth    = "REQUIRED"
    secret_arn  = aws_secretsmanager_secret.rds_auth_for_lambda_db_proxy.arn
  }
}

resource "aws_db_proxy_default_target_group" "default" {
  db_proxy_name = aws_db_proxy.this.name

  connection_pool_config {
    connection_borrow_timeout    = 120
    max_connections_percent      = 100
    max_idle_connections_percent = 50
    session_pinning_filters      = ["EXCLUDE_VARIABLE_SETS"]
  }
}

resource "aws_db_proxy_target" "default" {
  db_instance_identifier = aws_rds_cluster.this.id
  db_proxy_name          = aws_db_proxy.this.name
  target_group_name      = aws_db_proxy_default_target_group.default.name
}

Debug Output

module.database.aws_db_proxy_target.default: Destroying... [redacted/default/TRACKED_CLUSTER/redacted-prod-db]
╷
│ Error: Error deregistering DB Proxy target: InvalidParameterCombination: Must specify either DB instance identifier or DB cluster identifier, not both.
│ 	status code: 400,

Expected Behavior

The aws_db_proxy resource was destroyed successfully.

Actual Behavior

Destruction failed with InvalidParameterCombination. Presumably the provider is providing both the instance and DB cluster identifier, which AWS rejects as it only expects one or the other.

Steps to Reproduce

  1. terraform apply
  2. terraform destroy

Important Factoids

Target group is an Aurora cluster; [id=redacted/default/TRACKED_CLUSTER/redacted-prod-db]

References

https://docs.aws.amazon.com/cli/latest/reference/rds/deregister-db-proxy-targets.html

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/rds Issues and PRs that pertain to the rds service. labels Dec 5, 2021
@seanfdnn
Copy link
Author

seanfdnn commented Dec 5, 2021

Same error occurs with most recent versions:

Terraform v1.0.11
on linux_amd64
+ provider registry.terraform.io/hashicorp/archive v2.2.0
+ provider registry.terraform.io/hashicorp/aws v3.68.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/template v2.2.0

@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 7, 2021
@jorenvh1
Copy link

Any update or workaround for this one? I get the same error with provider version 5.26.0 when I try to remove an rds proxy instance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
Development

No branches or pull requests

3 participants