Skip to content

Commit

Permalink
Set min_vcpus to 0 if not defined for EC2 or SPOT
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazelier committed Jan 6, 2021
1 parent 058e72c commit 6e9b7cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions aws/resource_aws_batch_compute_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@ func resourceAwsBatchComputeEnvironmentCreate(d *schema.ResourceData, meta inter
}
if v, ok := computeResource["min_vcpus"]; ok && v.(int) > 0 {
input.ComputeResources.MinvCpus = aws.Int64(int64(v.(int)))
} else if computeResourceType == batch.CRTypeEc2 || computeResourceType == batch.CRTypeSpot {
input.ComputeResources.MinvCpus = aws.Int64(0)
}
if v, ok := computeResource["spot_iam_fleet_role"]; ok && len(v.(string)) > 0 {
input.ComputeResources.SpotIamFleetRole = aws.String(v.(string))
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/batch_compute_environment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ resource "aws_batch_compute_environment" "sample" {
* `instance_type` - (Optional) A list of instance types that may be launched. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.
* `launch_template` - (Optional) The launch template to use for your compute resources. See details below. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.
* `max_vcpus` - (Required) The maximum number of EC2 vCPUs that an environment can reach.
* `min_vcpus` - (Optional) The minimum number of EC2 vCPUs that an environment should maintain. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.
* `min_vcpus` - (Optional) The minimum number of EC2 vCPUs that an environment should maintain. For `EC2` or `SPOT` compute environments, if the parameter is not explicitly defined, a `0` default value will be set. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.
* `security_group_ids` - (Required) A list of EC2 security group that are associated with instances launched in the compute environment.
* `spot_iam_fleet_role` - (Optional) The Amazon Resource Name (ARN) of the Amazon EC2 Spot Fleet IAM role applied to a SPOT compute environment. This parameter is required for SPOT compute environments. This parameter isn't applicable to jobs running on Fargate resources, and shouldn't be specified.
* `subnets` - (Required) A list of VPC subnets into which the compute resources are launched.
Expand Down

0 comments on commit 6e9b7cf

Please sign in to comment.