Open dmitrykruglov opened 1 year ago
@dmitrykruglov I got the same issue when trying to upgrade multiple VNGs at once, and i believe it needs to be fixed or well documented in the provider Terraform docs.
If you want to rollout more than one VNG at the same time, you should do that from the Ocean cluster level (example below):
resource "spotinst_ocean_aws" "ocean_cluster" {
count = ..........
name = ..........
controller_id = ..........
region = ..........
image_id = ..........
iam_instance_profile = ..........
desired_capacity = ..........
min_size = ..........
max_size = ..........
security_groups = []
subnet_ids = ..........
key_name = ..........
update_policy {
should_roll = true
conditioned_roll = true|false
auto_apply_tags = true
roll_config {
batch_size_percentage = 33
launch_spec_ids = ["ols-a0b****1", "ols-a0b****1"]
batch_min_healthy_percentage = 20
respect_pdb = true
}
}
autoscaler {}
}
I managed to test this and it works perfectly fine for a list of VNGs.
The ocean_cluster documentation has the details for the configuration: https://registry.terraform.io/providers/spotinst/spotinst/latest/docs/resources/ocean_aws#update-policy
Hi @dmitrykruglov The error you encountered while updating 2 vngs is intended. In order to update 2 or more vngs you can configure "update_policy" in cluster config and can pass list of vng_ids as shown in snippet below.
update_policy { should_roll = true roll_config { batch_size_percentage = 33 launch_spec_ids = ["ols-a0b1", "ols-a0b1"] batch_min_healthy_percentage = 20 respect_pdb = true } }
Description
Hello,
We have 2 VNGs (
spotinst_ocean_aws_launch_spec
) that haveshould_roll
feature enabled (in order to automate cluster/VNG roll when configuration changes). When updating two VNGs at once in 1 terraform apply (for example AMI ID change), terraform fails with an error "Can't have 2 Rolls at the same time. Please stop the previous one". This is one of the reasons why we had to stop using VNGs for now and only use the default VNG to avoid this problem..Terraform Version
1.3.9
Affected Resource(s)
spotinst_ocean_aws_launch_spec
Terraform Configuration Files
Debug Output
Expected Behavior
Terraform shouldn't crash with an error. Cluster roll either needs to complete just once, applying changes to both VNGs, or VNGs need to roll independently at the same time.
Actual Behavior
Terraform crashes with the error "Can't have 2 Rolls at the same time" and fails to roll/apply changes to one of the VNGs.
Steps to Reproduce
spotinst/ocean-aws-k8s-vng/spotinst
module withshould_roll = true
.image_id
to a different image