ionos-cloud / terraform-provider-ionoscloud

The IonosCloud Terraform provider gives the ability to deploy and configure resources using the IonosCloud APIs.
Mozilla Public License 2.0
33 stars 21 forks source link

Add S3 support for managing buckets #557

Open salyh opened 1 month ago

salyh commented 1 month ago

Use-cases

Create a S3 bucket with terraform

Attempted Solutions

Did not find anything in the docs or code how to create a S3 bucket on IONOS cloud via terraform

Proposal

resource "ionoscloud_s3_bucket" "example" {
  name                = "mybucket"
  location            = "de/fra"
  ...
  ...
}
adeatcu-ionos commented 1 month ago

Hello! In the future (not in the near future) we will also implement this feature, but until then we recommend the use of other S3 services (since it is an open source protocol), here are some more details: https://docs.ionos.com/cloud/storage-and-backup/s3-object-storage/s3-tools.

cristiGuranIonos commented 1 month ago

Code example using the aws s3 provider to create a bucket:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.50.0"
    }
  }
}
# list of locations and endpoints here https://docs.ionos.com/cloud/storage-and-backup/s3-object-storage/s3-endpoints#frankfurt-germany-eu-central
provider "aws" {
  region                      = "de"
  # you can get these from dcd manager from s3 object manager Storage -> Key Management
  access_key                  = "access_key_here"
  secret_key                  = "secret_key_here"
  # all these checks need to be skipped for an s3 external provider
  skip_credentials_validation = true
  skip_requesting_account_id  = true
  skip_region_validation      = true
  endpoints {
     s3 = "https://s3-eu-central-1.ionoscloud.com"
  }
}

resource "aws_s3_bucket" "tf_bucket_name_here" {
  bucket = "youruniquebucketnamehere"
  tags = {
    Name        = "my bucket name tag"
    Environment = "dev"
  }
}
salyh commented 1 month ago

@cristiGuranIonos Thanks, worked well. Maybe its a good idea to include it somewhere in den official docs as an example?

cristiGuranIonos commented 1 month ago

Glad to hear. Yes, it is actually being added.