ThalesGroup / terraform-provider-ciphertrust

The CipherTrust Terraform Provider allows for the incorporation of CipherTrust Cloud Key Manager functionality into a CI/CD pipeline.
Apache License 2.0
6 stars 4 forks source link

Rotation on created keys are not working #11

Open anuj1366 opened 7 months ago

anuj1366 commented 7 months ago

Rotation on created keys is not functioning as expected. We've followed the configuration outlined in the Terraform documentation. Although the rotation job is successfully created, it's not properly attached to the keys that are generated.

Steps to Reproduce

  1. Deploy the key creation process using Terraform.
  2. Confirm that the rotation job is created.
  3. Observe that the rotation job is not properly linked or associated with the created keys.

Expected Behavior

The rotation job should automatically be attached to the keys upon creation, as per the configuration specified in the Terraform documentation.

Additional Information

# Create an linked XKS key with cm as key source in above linked external key store
resource "ciphertrust_aws_xks_key" "xks_linked_key_with_cm_as_source_1" {
  local_hosted_params {
    blocked = var.blocked
    custom_key_store_id = data.ciphertrust_aws_custom_keystore.by_resource_id.id
    linked = true
    source_key_id = ciphertrust_cm_key.cm_aes_key.id
    source_key_tier = "local"
  }
  description = "EKM key"
  alias = [var.keyalias]
      tags = {
        hosted = "EKM"
      }
  enable_rotation {
    key_source = "ciphertrust"
    job_config_id = ciphertrust_scheduler.aws_scheduled_key_rotation.id
  }
  schedule_for_deletion_days = 30  
}

resource "time_static" "createtime" {}
resource "ciphertrust_scheduler" "aws_scheduled_key_rotation" {
  cckm_key_rotation_params {
    cloud_name = "aws"
  }
  name       = format("rotation-%s", var.keyalias)
  operation  = "cckm_key_rotation"
  run_at     = format("%s %s %s %s *",time_static.createtime.minute,time_static.createtime.hour,time_static.createtime.day,time_static.createtime.month)
}