Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Terraform output:
│ Error: waiting for RDS Cluster (medconnect-dev-rds-instance) create: unexpected state 'error', wanted target 'available'. last error: %!s(<nil>)
│
│ with module.rds.aws_rds_cluster.rds_cluster,
│ on modules/rds/main.tf line 178, in resource "aws_rds_cluster" "rds_cluster":
│ 178: resource "aws_rds_cluster" "rds_cluster" {
Localstack output:
ERROR: '['apt', '-o=dir::cache=/var/lib/localstack/cache/apt', '-o=dir::cache::archives=/var/lib/localstack/cache/apt', '-y', '--no-install-recommends', 'update']': exit code 100; output: b"\nWARNING: apt does not have a stable CLI interface. Use with caution in scripts.\n\nGet:1 http://apt.postgresql.org/pub/repos/apt bookworm-pgdg InRelease [136 kB]\nErr:1 http://apt.postgresql.org/pub/repos/apt bookworm-pgdg InRelease\n At least one invalid signature was encountered.\nGet:2 http://deb.debian.org/debian bookworm InRelease [151 kB]\nGet:3 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]\nGet:4 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]\nErr:2 http://deb.debian.org/debian bookworm InRelease\n At least one invalid signature was encountered.\nErr:3 http://deb.debian.org/debian bookworm-updates InRelease\n At least one invalid signature was encountered.\nErr:4 http://deb.debian.org/debian-security bookworm-security InRelease\n At least one invalid signature was encountered.\nReading package lists...\nW: GPG error: http://apt.postgresql.org/pub/repos/apt bookworm-pgdg InRelease: At least one invalid signature was encountered.\nE: The repository 'http://apt.postgresql.org/pub/repos/apt bookworm-pgdg InRelease' is not signed.\nW: GPG error: http://deb.debian.org/debian bookworm InRelease: At least one invalid signature was encountered.\nE: The repository 'http://deb.debian.org/debian bookworm InRelease' is not signed.\nW: GPG error: http://deb.debian.org/debian bookworm-updates InRelease: At least one invalid signature was encountered.\nE: The repository 'http://deb.debian.org/debian bookworm-updates InRelease' is not signed.\nW: GPG error: http://deb.debian.org/debian-security bookworm-security InRelease: At least one invalid signature was encountered.\nE: The repository 'http://deb.debian.org/debian-security bookworm-security InRelease' is not signed.\n"
2025-07-04T16:29:08.761 WARN --- [-functhread5] l.p.c.s.rds.db_utils : Unable to startup DB instance: Installation of postgresql 14 failed. Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/packages/api.py", line 90, in install
self._prepare_installation(target)
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/packages/core.py", line 25, in _prepare_installation
A._os_switch(debian=A._debian_prepare_install,redhat=A._redhat_prepare_install,target=B)
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/packages/core.py", line 19, in _os_switch
if is_debian()or not in_docker()and debian_fallback:return debian(**A)
^^^^^^^^^^^
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/packages/postgres.py", line 19, in _debian_prepare_install
super()._debian_prepare_install(target)
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/packages/core.py", line 32, in _debian_prepare_install
def _debian_prepare_install(A,target):run(A._debian_cmd_prefix()+['update'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/run.py", line 119, in run
raise e
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/utils/run.py", line 69, in run
output = subprocess.check_output(cmd, shell=shell, stderr=stderr, env=env_dict, cwd=cwd)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['apt', '-o=dir::cache=/var/lib/localstack/cache/apt', '-o=dir::cache::archives=/var/lib/localstack/cache/apt', '-y', '--no-install-recommends', 'update']' returned non-zero exit status 100.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/services/rds/db_utils.py.enc", line 63, in A
try:B and B(status='creating');G=F.start_db_instance(*E,**D);B and B(status=_D);LOG.debug('DB started successfully.');return G
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/pro/core/services/rds/engine_postgres.py.enc", line 61, in start_db_instance
if config.is_in_docker:postgresql_package.install(version=P)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/packages/api.py", line 220, in install
self.get_installer(version).install(target)
File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack/packages/api.py", line 106, in install
raise PackageException(f"Installation of {self.name} {self.version} failed.") from e
localstack.packages.api.PackageException: Installation of postgresql 14 failed.
Expected Behavior
I expect that the rds cluster will be created successfully.
How are you starting LocalStack?
With a docker-compose file
Steps To Reproduce
How are you starting localstack (e.g., bin/localstack
command, arguments, or docker-compose.yml
)
docker-compose -f "$LOCALSTACK_RELATIVE_PATH/docker-compose.yml" up -d
version: '3.8'
services:
localstack:
image: test-localstack-pro:latest
ports:
- "4566:4566"
- "4510-4559:4510-4559"
environment:
- SERVICES=ec2,lambda,s3,apigateway,apigatewaymanagementapi,cognito-idp,secretsmanager,lambda,acm,iam,route53,route53resolver,ses,ssm,ce,cloudfront,cognito-identity,rds-data,rds,events,logs,wafv2,sns,cloudwatch,xray
- DISABLE_CORS_CHECKS=1
- DEBUG=1
- CLOUDFRONT_STATIC_PORTS=1
- LOCALSTACK_API=true
- PERSISTENCE=/tmp/localstack/data
- DOCKER_HOST=unix:///var/run/docker.sock
- AWS_DEFAULT_REGION=eu-central-1
- GATEWAY_LISTEN=0.0.0.0:4566
- EXTERNAL_SERVICE_PORTS_START=4510
- EXTERNAL_SERVICE_PORTS_END=4559
- LAMBDA_RUNTIME_ENVIRONMENT_TIMEOUT=60
- LOCALSTACK_AUTH_TOKEN="pro-token"
- MAIN_CONTAINER_NAME=test-localstack-main-1
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "./.volume/localstack:/var/lib/localstack"
Terraform apply (RDS
tflocal apply -var-file="$TF_VAR_FILE"
env file:
database_engine = "aurora-postgresql"
database_engine_version = "14.9"
database_port = 4545
RDS tf file:
# /-- RDS DB
resource "aws_db_subnet_group" "private_rds_group" {
name = "${var.namespace}-rds-cluster-subnet-group"
description = "RDS private subnet group"
subnet_ids = var.private_subnets_ids
tags = {
Name = "${var.namespace}-sb-subnet-group-rds"
}
}
resource "aws_rds_cluster" "rds_cluster" {
cluster_identifier = "${var.namespace}-rds-instance"
engine = var.database_engine
engine_mode = "provisioned"
engine_version = var.database_engine_version
database_name = var.database_name
master_username = "dbroot"
master_password = random_password.db_master_pass.result
db_subnet_group_name = aws_db_subnet_group.private_rds_group.id
vpc_security_group_ids = [aws_security_group.security_group_rds_private.id]
iam_database_authentication_enabled = true
apply_immediately = true
skip_final_snapshot = true
storage_encrypted = true
port = var.database_port
backup_retention_period = var.backup_retention_period
serverlessv2_scaling_configuration {
min_capacity = 0.5
max_capacity = 1.0
}
tags = {
Name = "${var.namespace}-rds-cluster"
}
depends_on = [random_password.db_master_pass, aws_db_subnet_group.private_rds_group, aws_security_group.security_group_rds_private]
}
resource "aws_rds_cluster_instance" "rds_instance" {
cluster_identifier = aws_rds_cluster.rds_cluster.id
instance_class = "db.serverless"
engine = aws_rds_cluster.rds_cluster.engine
engine_version = aws_rds_cluster.rds_cluster.engine_version
apply_immediately = true
db_subnet_group_name = aws_db_subnet_group.private_rds_group.id
publicly_accessible = false
auto_minor_version_upgrade = false
tags = {
Name = "${var.namespace}-rds-instance"
}
depends_on = [aws_rds_cluster.rds_cluster, aws_db_subnet_group.private_rds_group]
}
Environment
- OS: macOS 15.3.1 (24D70)
- LocalStack:
LocalStack version: 4.6.1.dev4
LocalStack build date: 2025-07-04
LocalStack build git hash: ad5a99a1f
Anything else?
No response