EMR Module issue with scaling policy

Hello,
I am currently using this module below.

module “emr” {
source = “terraform-aws-modules/emr/aws”
version = “2.3.0”
}

I am trying to add managed_scaling_policy to the emr cluster when creating.

managed_scaling_policy = {
  compute_limits = {
    unit_type                    = "InstanceFleetUnits"  
    minimum_capacity_units       = 4                  
    maximum_capacity_units       = 20                    
    maximum_on_demand_capacity_units = 10            
    maximum_core_capacity_units  = 5                    
  }
}

When I try to add something like this above. I am getting this error. It seems like the module supports this but not sure if I am missing something. Any help would be appreciated.

Error: Unsupported attribute
│
│   on .terraform\modules\emr\main.tf line 451, in resource "aws_emr_managed_scaling_policy" "this":
│  451:     unit_type                       = var.managed_scaling_policy.unit_type
│     ├────────────────
│     │ var.managed_scaling_policy is object with 1 attribute "compute_limits"
│
╵
╷
│ Error: Unsupported attribute
│
│   on .terraform\modules\emr\main.tf line 452, in resource "aws_emr_managed_scaling_policy" "this":
│  452:     minimum_capacity_units          = var.managed_scaling_policy.minimum_capacity_units
│     ├────────────────
│     │ var.managed_scaling_policy is object with 1 attribute "compute_limits"
│
│ This object does not have an attribute named "minimum_capacity_units".
╵
╷
│ Error: Unsupported attribute
│
│   on .terraform\modules\emr\main.tf line 453, in resource "aws_emr_managed_scaling_policy" "this":
│  453:     maximum_capacity_units          = var.managed_scaling_policy.maximum_capacity_units
│     ├────────────────
│     │ var.managed_scaling_policy is object with 1 attribute "compute_limits"
│
│ This object does not have an attribute named "maximum_capacity_units".

Hi @solve-rditusa,

It looks like that module expects the various limits to be assigned directly to the managed_scaling_policy object itself, without the intermediate compute_limits attribute. There is no type definition or examples for that variable, but seeing how the module is accessing those attribute directly I would just remove compute_limits.

Great thank you this worked.