Skip to content

Commit 545fe09

Browse files
philippart-sscraly
andauthored
feat: πŸ“€ Add S3 creation example (#90)
* feat: πŸ“€ Add S3 creation example * doc: πŸ“ Add link to the official object container storage docs * review: clean with only the necessary providers and config * fix: mispelling --------- Co-authored-by: Aurelie Vache <[email protected]>
1 parent d45e521 commit 545fe09

File tree

6 files changed

+59
-0
lines changed

6 files changed

+59
-0
lines changed

β€ŽREADME.mdβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Here is the several topics:
4343
β”œβ”€β”€ databases-analytics ## Here you find demo about databases, data streaming, data integration, ...
4444
β”œβ”€β”€ iam ## Here you find demo about IAM (roles, identity, ...)
4545
β”œβ”€β”€ network ## Here you find demo about network (private network, load balancer, gateway, VPS ...)
46+
β”œβ”€β”€ storage ## Here you find demo about storage (object storage, block storage, ...)
4647
└── use-cases ## Here you find use cases (examples using several services: kubernetes, databases...)
4748
```
4849

β€Žstorage/README.mdβ€Ž

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Storage demos
2+
3+
Here you will find some demos on how to use and manage OVHcloud storage products.
4+
5+
## Object storage
6+
7+
> S3 is a registered trademark of Amazon Technologies, Inc. OVHcloud services are not sponsored, approved, or affiliated in any way.
8+
9+
- How to [create a S-3 compatible objects with Terraform](./s3-with-tf)

β€Žstorage/s3-with-tf/README.mdβ€Ž

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Create a simple Object container storage
2+
3+
To run this TF code you need to set some environment variables (mandatory for AWS provider):
4+
5+
```
6+
export AWS_ACCESS_KEY_ID="<your_access_key>"
7+
export AWS_SECRET_ACCESS_KEY="<your_secret_access_key>"
8+
```
9+
10+
11+
Run the TF command `terraform apply`:
12+
```bash
13+
$ terraform apply
14+
```
15+
16+
To destroy the bucket with all the objects inside, run the command `terraform destroy`.
17+
18+
For more information about object container storage you can read the [OVHcloud documentation](https://help.ovhcloud.com/csm/en-ie-documentation-storage-object-storage?id=kb_browse_cat&kb_id=38e74da5a884a950f07829d7d5c75217&kb_category=b29021c8e5a5edd0f078850a25104df8&spa=1).
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Create the bucket, the force_destroy argument will destroy the bucket even if it contains objects
2+
resource "aws_s3_bucket" "my-bucket-s3" {
3+
force_destroy = true
4+
bucket = "bucket-name" # the name must be unique within OVHcloud
5+
}

β€Žstorage/s3-with-tf/output.tfβ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Output the Object Storage name after its creation
2+
3+
output "my-bucket-s3" {
4+
value = "${aws_s3_bucket.my-bucket-s3.id}"
5+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
terraform {
2+
required_providers {
3+
aws = {
4+
source = "hashicorp/aws"
5+
}
6+
}
7+
}
8+
9+
# Configure the AWS Provider
10+
provider "aws" {
11+
region = "gra"
12+
13+
# OVH implementation has no STS service
14+
skip_credentials_validation = true
15+
skip_requesting_account_id = true
16+
# the gra region is unknown to AWS hence skipping is needed.
17+
skip_region_validation = true
18+
endpoints {
19+
s3 = "https://s3.gra.io.cloud.ovh.net"
20+
}
21+
}

0 commit comments

Comments
Β (0)