diff --git a/projects/crossplane/manifests/composition-bucket.yml b/projects/crossplane/manifests/composition-bucket.yml new file mode 100644 index 00000000..337e917e --- /dev/null +++ b/projects/crossplane/manifests/composition-bucket.yml @@ -0,0 +1,138 @@ +apiVersion: apiextensions.crossplane.io/v1 +kind: Composition +metadata: + annotations: + labels: + implementation: terraform + provider: minio + name: tf-bucket.gnu.one +spec: + compositeTypeRef: + apiVersion: s3.gnu.one/v1alpha1 + kind: XBucket + mode: Resources + publishConnectionDetailsWithStoreConfigRef: + name: default + resources: + - base: + apiVersion: tf.upbound.io/v1beta1 + kind: Workspace + spec: + forProvider: + module: | + terraform { + required_providers { + minio = { + source = "aminueza/minio" + version = "1.17.2" + } + } + } + + variable "access_key" { + description = "S3 Access Key" + type = string + } + + variable "secret_key" { + description = "S2 Secret Key" + type = string + sensitive = true + } + + variable "name" { + description = "Name of Bucket & Service Account" + type = string + } + + variable "endpoint" { + description = "Minio Endpoint" + type = string + default = "s3-minio.s3.svc.cluster.local:9000" + } + + provider "minio" { + minio_server = var.endpoint + minio_user = var.access_key + minio_password = var.secret_key + } + + resource "minio_s3_bucket" "bucket" { + bucket = var.name + acl = "private" + force_destroy = false + } + + resource "minio_iam_policy" "policy" { + name = var.name + policy= <