terraform-provider-spotinst icon indicating copy to clipboard operation
terraform-provider-spotinst copied to clipboard

required image_id conflicts with AMI auto update task

Open msvechla opened this issue 6 months ago • 0 comments

Affected Resource(s)

  • spotinst_ocean_aws

Terraform Configuration Files

resource "spotinst_ocean_aws" "ocean_eks" {
...
  image_id                    = var.eks_ami

  scheduled_task {
    tasks {
      is_enabled      = true
      cron_expression = var.spotinst_ami_auto_update_schedule
      task_type       = "amiAutoUpdate"
      parameters {
        ami_auto_update {
          apply_roll = true
          ami_auto_update_cluster_roll {
            comment                      = "spot ami auto update"
            batch_min_healthy_percentage = 100
            batch_size_percentage        = 20
            respect_pdb                  = true
          }
          minor_version = true
          patch         = true
        }
      }
    }
  }

  lifecycle {
    ignore_changes = [
      image_id          # image_id is a dynamic value that is modified by Spotinst. It should only be set initially
    ]
  }
}

Expected Behavior

image_id should not be required when using the AMI auto update feature, as it would conflict with values auto-updated by spot.io.

Actual Behavior

image_id is required

Additional Info

Can you elaborate on how AMI auto update should be used with this terraform provider? It seems like the required image_id will conflict with changes that are done automatically by the AMI auto update feature.

As a temporary workaround we added lifecycle ignore_changes to the image_id value, however if we want to make the AMI auto update feature a toggle, this would not be possible, as conditionals are not allowed on the lifecycle.

Of course there are some other workarounds, but it feels like this is a design issue that should be solved on the provider level.

What do you think? Thanks a lot for your support!

Community Note

  • Please vote on this issue by adding a 👍 reaction to help the community and maintainers prioritize this request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

msvechla avatar Feb 27 '24 07:02 msvechla