FlexibleEngineCloud / terraform-provider-flexibleengine

Terraform flexibleengine provider
https://www.terraform.io/docs/providers/flexibleengine/
Mozilla Public License 2.0
30 stars 52 forks source link

Allow to use an existing OBS with flexibleengine_cce_pvc resource #1065

Open MrLuje opened 8 months ago

MrLuje commented 8 months ago

Hello

I want to create a k8s PVC binded to an OBS bucket with specific lifecycle, encryption, etc With flexibleengine_cce_pvc, you can't specify an existing OBS nor lifecycle, etc

What I'm doing now is creating the flexibleengine_cce_pvc then import the OBS as a flexibleengine_obs_bucket resource then apply more modifications.

It would be better if I can create the flexibleengine_obs_bucket then use it as an existing OBS in flexibleengine_cce_pvc creation, like web console image

Terraform Version

1.3.2

Affected Resource(s)

Terraform Configuration Files

# Create this
resource "flexibleengine_cce_pvc" "pvc" {
  cluster_id = var.cce.cluster_id
  namespace  = var.cce.namespace
  name       = var.cce.claim_name
  annotations = {
    "everest.io/obs-volume-type" = "STANDARD"
    "csi.storage.k8s.io/fstype"  = "s3fs"
  }
  storage_class_name = "csi-obs"
  access_modes       = ["ReadWriteMany"]
  storage            = var.default_size
}

# uncomment and import the generated OBS
# resource "flexibleengine_obs_bucket" "obs" {
#   bucket   = "pvc-${flexibleengine_cce_pvc.pvc.id}"

#   encryption = var.encryption.enabled
#   kms_key_id = var.encryption.kms_key_id

#   lifecycle_rule {
#     name    = "expiration"
#     enabled = true
#     expiration {
#       days = 7
#     }
#   }
# }
Jason-Zhang9309 commented 6 months ago

this resource will be deprecated soon, it's recommend to use kubernetes provider please check these docs: https://docs.prod-cloud-ocb.orange-business.com/usermanual2/cce/cce_10_0379.html https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/persistent_volume_claim