Skip to content

Validation for memory fails for large instances #24

@kagkarlsson

Description

@kagkarlsson

There is some error in the validation rule for max-mem for a postgres instance when using the fields cpu and memory

Settings such as this causes validation error. I assume max-mem is dependent on number of cores, and that this error is incorrect: Memory must be divisable by 256, and between 3840 and 13312.

Input

machine_size = {
    cpu = 8
    memory = 30720
}

Error

terraform plan -var-file=env/kub-ent-prd.tfvars
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

module.init.data.google_projects.app_projects: Refreshing state... [id=lifecycleState:ACTIVE labels.purpose:app-project labels.app_id:payment labels.environment:prd]
module.init.data.google_projects.network_projects: Refreshing state... [id=lifecycleState:ACTIVE labels.app_short:network labels.environment:prd]
module.init.data.google_projects.kubernetes_projects: Refreshing state... [id=lifecycleState:ACTIVE labels.kubernetes:true labels.environment:prd]
module.init.data.google_compute_network.main_network_project_vpc: Refreshing state... [id=projects/ent-networks-prd-001/global/networks/vpc-prd-001]
module.init.data.google_service_account.application_default: Refreshing state... [id=projects/ent-payment-prd/serviceAccounts/application@ent-payment-prd.iam.gserviceaccount.com]
module.redis.google_redis_instance.main: Refreshing state... [id=projects/ent-payment-prd/locations/europe-west1/instances/mem-payment-prd-001]
module.redis.kubernetes_config_map.main_redis_connection: Refreshing state... [id=payment/payment-redis-connection]

Error: Invalid value for variable

  on main.tf line 20, in module "postgres":
  20:     machine_size           = var.machine_size

Memory must be divisable by 256, and between 3840 and 13312.

This was checked by the validation rule at
.terraform/modules/postgres/modules/postgresql/variables.tf:40,3-13.

Workaround for now

Current workaround is setting

machine_size = {
    tier    = "db-custom-8-30720"
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions