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

Enabling the RDS Data API for Postgres Serverless v2 #440

Open
1 task done
jritsema opened this issue Mar 22, 2024 · 6 comments
Open
1 task done

Enabling the RDS Data API for Postgres Serverless v2 #440

jritsema opened this issue Mar 22, 2024 · 6 comments

Comments

@jritsema
Copy link

jritsema commented Mar 22, 2024

Description

For enable_http_endpoint, the docs say:

Enable HTTP endpoint (data API). Only valid when engine_mode is set to serverless

I was able to enable this when creating a serverless v2 cluster using the AWS console, so are the docs correct here?

When I tested it in Terraform, it appears to try setting it but ultimately did not work.

provider "aws" {}

variable "name" {
  type    = string
  default = "tf-aurora-postgres-serverless"
}

data "aws_rds_engine_version" "postgresql" {
  engine  = "aurora-postgresql"
  version = "15.4"
}

# lookup vpc by id
data "aws_vpc" "main" {
  id = "vpc-123456789012"
}

module "aurora_postgresql_v2" {
  source = "terraform-aws-modules/rds-aurora/aws"

  name              = var.name
  engine            = data.aws_rds_engine_version.postgresql.engine
  engine_mode       = "provisioned"
  engine_version    = data.aws_rds_engine_version.postgresql.version
  storage_encrypted = true

  master_username             = "postgres"
  manage_master_user_password = true
  enable_http_endpoint        = true

  vpc_id = data.aws_vpc.main.id

  db_subnet_group_name = module.vpc.database_subnet_group_name

  backup_retention_period = 7

  monitoring_interval = 60

  apply_immediately   = true
  skip_final_snapshot = true

  serverlessv2_scaling_configuration = {
    min_capacity = 0.5
    max_capacity = 2
  }

  instance_class = "db.serverless"
  instances = {
    one = {}
  }
}
Terraform will perform the following actions:

  # module.aurora_postgresql_v2.aws_rds_cluster.this[0] will be updated in-place
  ~ resource "aws_rds_cluster" "this" {
      ~ enable_http_endpoint                = false -> true
        id                                  = "tf-aurora-postgres-serverless"
        tags                                = {}
        # (39 unchanged attributes hidden)

        # (2 unchanged blocks hidden)
    }

If your request is for a new feature, please use the Feature request template.

  • ✋ I have searched the open/closed issues and my issue is not listed.

Versions

  • Module version [Required]: 9.2.1

  • Terraform version:

  • Provider version(s):
Terraform v1.3.7
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.41.0

Reproduction Code [Required]

Steps to reproduce the behavior:

Expected behavior

Actual behavior

Terminal Output Screenshot(s)

Additional context

@bryantbiggs
Copy link
Member

we (typically) pull the argument description directly from upstream - this is the value that they currently have, but I have not checked if RDS has made changes that have relaxed/expanded support for this https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster#enable_http_endpoint

@jritsema
Copy link
Author

It looks like the doc comment is incorrect and there's a PR in flight in the provider to resolve. It didn't appear to work but I will test again and update here. hashicorp/terraform-provider-aws#35691

@jritsema
Copy link
Author

jritsema commented Apr 2, 2024

I can verify that the doc in this project is incorrect.

Enable HTTP endpoint (data API). Only valid when engine_mode is set to serverless

Enabling HTTP endpoint (data API) does work when engine_mode is provisioned. It cannot be changed after creation which explains what I was seeing.

Here is the open issue in the provider for this. Looks like someone closed the associated PR that would change the description to the following:

Enable HTTP endpoint (data API). Only valid when `engine_mode` is set to `serverless` or when `engine` is set to `aurora-postgresql` and `engine_mode` is set to `provisioned`.

I can submit a PR in this repo, however, I understand if you want to wait and pull from upstream.

@kzhou57
Copy link

kzhou57 commented Apr 18, 2024

We found a case that with engine is set to aurora-postgresql and engine_mode is set to provisioned, the terraform said the change is applied, but from AWS console , it still shows the Data API disabled.

Does anyone know what's going on here ? Is there a way to troubleshooting ?

@rowen-anetac
Copy link

We found a case that with engine is set to aurora-postgresql and engine_mode is set to provisioned, the terraform said the change is applied, but from AWS console , it still shows the Data API disabled.

Does anyone know what's going on here ? Is there a way to troubleshooting ?

Might want to double check you are in a supported region, that was my issue. This is only supported in 4 regions right now:

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Concepts.Aurora_Fea_Regions_DB-eng.Feature.Data_API.html#Concepts.Aurora_Fea_Regions_DB-eng.Feature.Data_API.apg

It will fail silently if executed in a region without support

Copy link

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added the stale label May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants