mercredi 3 mars 2021

Detect change in random_uuid resource

I have following random resource created

resource random_uuid iteration {
  keepers = {
    service_name = var.name
    kms_key      = var.key
  }
}

Is there a way to detect the fact that random_uuid changed? Something like random_uuid.iteration.changed attribute. Or, alternatively, somehow compare new value with previous one.

In my particular scenario I need to allow overwrite of aws_ssm_parameter resource only when the uuid has changed. So something like

resource aws_ssm_parameter private_key_parameter {
  ...
  ...
  ...
  overwrite = random_uuid.iteration.changed
  ...
}

or

resource aws_ssm_parameter private_key_parameter {
  ...
  ...
  ...
  overwrite = random_uuid.iteration.result != random_uuid.iteration.previous
  ...
}

or equivalent. Is this possible?




Aucun commentaire:

Enregistrer un commentaire