Terraform v0.11.7
+ provider.aws v1.19.0
resource aws_batch_compute_environment batch_env {
compute_environment_name = "postgres-loader"
service_role = "arn:aws:iam::XXXXXXXXXX:role/service-role/AWSBatchServiceRole"
type = "MANAGED"
compute_resources {
type = "EC2"
instance_role = "arn:aws:iam::XXXXXXXXXX:instance-profile/ecsInstanceRole"
instance_type = ["optimal"]
min_vcpus = 1
max_vcpus = 32
subnets = ["${local.subnet_ids}"]
security_group_ids = ["${aws_security_group.batch.id}"]
tags {
Name = "insights"
Environment = "production"
}
}
}
https://gist.github.com/jasantunes/397662245f1877848215e69182c1ecf4
N/A.
It should've accepted the min_vcpu
and max_vcpu
parameters and infer nothing about parameter desired_vcpus
that was not set and is optional.
Error: Error applying plan:
1 error(s) occurred:
* aws_batch_compute_environment.batch_env: 1 error(s) occurred:
* aws_batch_compute_environment.batch_env: : Error executing request, Exception : desiredvCpus should be between minvCpus and maxvCpus, RequestId: 06362c77-6133-11e8-8122-077fbc0c56df
status code: 400, request id: 06362c77-6133-11e8-8122-077fbc0c56df
Create a aws_batch_compute_environment
resource without setting desired_vcpus
parameter in compute_resources
.
N/A.
This also impacts updating batch if the desired_vcpus is set. It doesn't allow it to be optional. If ommitted it resets to 0, and if present (but the ignore_changes lifecycle is set for desired_vcpus) it doesn't ignore it.
I've started to take a look at the code, but I'm a little stumped.
Hi, same issue as described by @andylockran . This is quite annoying especially because we have no way to skip this setting (even ignore_changes doesn't works as expected...)
I think I may have a workaround; though I’ve upgraded to 0.12.10 so it’s potentially a different solution.
I’ll share the 0.12.10 solution and can see if that works on 0.11.0
Sent from my iPhone
On 8 Nov 2019, at 13:45, David Galichet notifications@github.com wrote:
Hi, same issue as described by @andylockran . This is quite annoying especially because we have no way to skip this setting (even ignore_changes doesn't works as expected...)—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
I have found that ignoring compute_resources.0.desired_vcpus
works.
Thanks for describing the workaround @pgieser. For the convenience of anyone running into this:
The workaround is to add this line in the aws_batch_compute_environment
:
lifecycle { ignore_changes = [compute_resources.0.desired_vcpus] }
Confirm that the workaround of @falktan works as of today, terraform plan does not show the changes of desired_vcpu.
I also found that another workaround works as below:
lifecycle {
ignore_changes = [
compute_resources[0].desired_vcpus,
]
}
terraform --version
Terraform v0.12.24
Hi everyone 👋 The fixes for the resource will support fully optional desired_vcpus
have been merged and will release with version 2.68.0 of the Terraform AWS Provider, likely tomorrow. Workarounds such as ignore_changes
should no longer be necessary after this release. Thanks to @hectcastro for the investigative and implementation help. 👍
This has been released in version 2.68.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.
For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
I have found that ignoring
compute_resources.0.desired_vcpus
works.