UpCloudLtd / terraform-provider-upcloud

Terraform provider for UpCloud
https://registry.terraform.io/providers/UpCloudLtd/upcloud
MIT License
62 stars 30 forks source link

Feature request: TF resource for buckets #645

Open Pionerd opened 1 month ago

Pionerd commented 1 month ago

Currently we can make the Managed Object Storage via Terraform, but not the actual buckets inside them. It would be great if we could make those as well.

kangasta commented 1 month ago

Thanks for the feature request! We are looking into adding bucket resource to the provider soon.

back-2-95 commented 1 month ago

I'm using AWS provider meanwhile like this:

#
# AWS provider with UpCloud connection
#

provider "aws" {
  region     = "us-east-1" # Just for faking
  access_key = upcloud_managed_object_storage_user_access_key.admin-access-key.access_key_id
  secret_key = upcloud_managed_object_storage_user_access_key.admin-access-key.secret_access_key

  skip_credentials_validation = true
  skip_requesting_account_id  = true
  skip_region_validation      = true
  s3_use_path_style           = true

  endpoints {
    s3 = "https://${one(upcloud_managed_object_storage.default.endpoint).domain_name}"
  }
}

#
# Buckets
#

resource "aws_s3_bucket" "bucket" {
  bucket   = "mybucket"
}

resource "aws_s3_bucket_lifecycle_configuration" "bucket-lifecycle" {
  bucket = aws_s3_bucket.bucket.id

  rule {
    id = "DeleteOldVersions"

    noncurrent_version_expiration {
      noncurrent_days = 30
    }

    status = "Enabled"
  }
}