Bitnami postgresql change max_connections

5.4k Views Asked by At

I am installing postgresql using terraform on my kubernetes cluster.

I am using bitnami https://artifacthub.io/packages/helm/bitnami/postgresql/11.6.19 this chart.

My terraform resource is something like below

resource "helm_release" "postgres" {
  chart = "postgresql"
  name = "postgresql-postgresql"
  version = "11.6.19"
  timeout = 600
  repository = "https://charts.bitnami.com/bitnami"
  namespace = "default"

  values = [
    file("${path.module}/postgresql-persistence/values.yaml")
  ]
}

And I am overriding few settings using values.yaml file, as below.

primary:
    extendedConfiguration: |
        max_connections = 400
    initdb:
        scripts:
            my_init_script.sql: |
                CREATE DATABASE iam;
                GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO sales;

But when I run this, I am getting following error in console.

rendered manifests contain a resource that already exists. Unable to continue with install: existing resource conflict: namespace: default, name: postgresql-postgresql-extended-configuration, existing_kind: /v1, Kind=ConfigMap, new_kind: /v1, Kind=ConfigMap

Can someone please tell me how can I set max_connection using terraform with bitnami chart ?

Thanks

1

There are 1 best solutions below

0
On

You can try the following

You already have postgresql-postgresql-extended-configuration configMap created.

by adding the following to your values.YAML

extendedConfiguration: |
        max_connections = 400

It will try to create a new configMap with the same postgresql-postgresql-extended-configuration

you can list all the config maps and delete postgresql-postgresql-extended-configuration

kubectl get configmap -n kubernetes-namespace

kubectl delete configmap config-map-name -n kubernetes-namespace

in your case config map name is postgresql-postgresql-extended-configuration

try to reinstall this worked for me