hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.87k stars 9.21k forks source link

[Bug]: postgres_settings do nothing #35834

Open LiterallyDad opened 9 months ago

LiterallyDad commented 9 months ago

Terraform Core Version

1.5.7

AWS Provider Version

5.36.0

Affected Resource(s)

aws_dms_endpoint

Expected Behavior

image

Actual Behavior

apply succeeds, resource is not updated, prevents TF from auto stopping/starting serverless replications

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5"
    }
  }

  backend "s3" {
    bucket = "your-bucket"
    key    = "your.tfstate"
    region = "us-east-1"
  }
}

provider "aws" {
  region = "us-east-1"
}
resource "aws_dms_endpoint" "your_postgres" {
  endpoint_id   = "your-${terraform.workspace}-dms-postgres-source-endpoint"
  endpoint_type = "source"
  engine_name   = "postgres"
  depends_on    = [aws_iam_role_policy.your_dms]
  username      = data.aws_secretsmanager_secret_version.rds_username.secret_string
  password      = data.aws_secretsmanager_secret_version.rds_password.secret_string
  server_name   = data.aws_secretsmanager_secret_version.rds_host.secret_string
  database_name = data.aws_secretsmanager_secret_version.rds_dbname.secret_string
  port          = 5432

  postgres_settings {
    //this is the heartbeat setting that works, however TF is not able to apply it.
    heartbeat_enable = true
  }

Steps to Reproduce

attempt to apply aws_dms_endpoint with postgres_settings config block

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 9 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

justinretzolk commented 8 months ago

Hey @LiterallyDad 👋 Thank you for taking the time to raise this! Are you able to supply debug logs (redacted as needed)? There's often helpful information in there for whoever picks this issue up.

AlexSchultz-clumio commented 2 months ago

This looks like it's because the expandPostgreSQLSettings call is only used during create and only a subset of settings are checked for updates. It it may be that those settings are currently only managed on create and cannot be updated after the fact even though you can make those changes via the UI on an established endpoint.

https://github.com/hashicorp/terraform-provider-aws/blob/787e6038218fc65927482f01655a507a2eb2198c/internal/service/dms/endpoint.go#L828-L830 https://github.com/hashicorp/terraform-provider-aws/blob/787e6038218fc65927482f01655a507a2eb2198c/internal/service/dms/endpoint.go#L1129-L1131

mmmaction commented 2 days ago

We are also running into this issue in our setup where we use DMS and Postgres as source.

Any update on this issue? Is there a workaround? Will it help when defining postgres settings via extra_connection_attributes in aws_dms_endpoint ?