Fix guide formatting (#624)

* Fix guide formatting

* Fix template
This commit is contained in:
Vicente Pinto 2025-01-10 13:08:37 +00:00 committed by GitHub
parent 700bdc90d0
commit 80966da59e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 120 additions and 120 deletions

View file

@ -11,81 +11,81 @@ This guide outlines the process of utilizing the [AWS Terraform Provider](https:
1. **Configure STACKIT Provider** 1. **Configure STACKIT Provider**
First, configure the STACKIT provider to connect to the STACKIT services. First, configure the STACKIT provider to connect to the STACKIT services.
```hcl ```hcl
provider "stackit" { provider "stackit" {
region = "eu01" region = "eu01"
} }
``` ```
2. **Define STACKIT Object Storage Bucket** 2. **Define STACKIT Object Storage Bucket**
Create a STACKIT Object Storage Bucket and obtain credentials for the AWS provider. Create a STACKIT Object Storage Bucket and obtain credentials for the AWS provider.
```hcl ```hcl
resource "stackit_objectstorage_bucket" "example" { resource "stackit_objectstorage_bucket" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example" name = "example"
} }
resource "stackit_objectstorage_credentials_group" "example" { resource "stackit_objectstorage_credentials_group" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-credentials-group" name = "example-credentials-group"
} }
resource "stackit_objectstorage_credential" "example" { resource "stackit_objectstorage_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
credentials_group_id = stackit_objectstorage_credentials_group.example.credentials_group_id credentials_group_id = stackit_objectstorage_credentials_group.example.credentials_group_id
expiration_timestamp = "2027-01-02T03:04:05Z" expiration_timestamp = "2027-01-02T03:04:05Z"
} }
``` ```
3. **Configure AWS Provider** 3. **Configure AWS Provider**
Configure the AWS Provider to connect to the STACKIT Object Storage bucket. Configure the AWS Provider to connect to the STACKIT Object Storage bucket.
```hcl ```hcl
provider "aws" { provider "aws" {
region = "eu01" region = "eu01"
skip_credentials_validation = true skip_credentials_validation = true
skip_region_validation = true skip_region_validation = true
skip_requesting_account_id = true skip_requesting_account_id = true
access_key = stackit_objectstorage_credential.example.access_key access_key = stackit_objectstorage_credential.example.access_key
secret_key = stackit_objectstorage_credential.example.secret_access_key secret_key = stackit_objectstorage_credential.example.secret_access_key
endpoints { endpoints {
s3 = "https://object.storage.eu01.onstackit.cloud" s3 = "https://object.storage.eu01.onstackit.cloud"
}
} }
} ```
```
4. **Use the provider to manage objects or policies** 4. **Use the provider to manage objects or policies**
```hcl ```hcl
resource "aws_s3_object" "test_file" { resource "aws_s3_object" "test_file" {
bucket = stackit_objectstorage_bucket.example.name bucket = stackit_objectstorage_bucket.example.name
key = "hello_world.txt" key = "hello_world.txt"
source = "files/hello_world.txt" source = "files/hello_world.txt"
content_type = "text/plain" content_type = "text/plain"
etag = filemd5("files/hello_world.txt") etag = filemd5("files/hello_world.txt")
} }
resource "aws_s3_bucket_policy" "allow_public_read_access" { resource "aws_s3_bucket_policy" "allow_public_read_access" {
bucket = stackit_objectstorage_bucket.test20.name bucket = stackit_objectstorage_bucket.test20.name
policy = <<EOF policy = <<EOF
{ {
"Statement":[ "Statement":[
{ {
"Sid": "Public GET", "Sid": "Public GET",
"Effect":"Allow", "Effect":"Allow",
"Principal":"*", "Principal":"*",
"Action":"s3:GetObject", "Action":"s3:GetObject",
"Resource":"urn:sgws:s3:::example/*" "Resource":"urn:sgws:s3:::example/*"
} }
] ]
} }
EOF EOF
} }
``` ```

View file

@ -11,81 +11,81 @@ This guide outlines the process of utilizing the [AWS Terraform Provider](https:
1. **Configure STACKIT Provider** 1. **Configure STACKIT Provider**
First, configure the STACKIT provider to connect to the STACKIT services. First, configure the STACKIT provider to connect to the STACKIT services.
```hcl ```hcl
provider "stackit" { provider "stackit" {
region = "eu01" region = "eu01"
} }
``` ```
2. **Define STACKIT Object Storage Bucket** 2. **Define STACKIT Object Storage Bucket**
Create a STACKIT Object Storage Bucket and obtain credentials for the AWS provider. Create a STACKIT Object Storage Bucket and obtain credentials for the AWS provider.
```hcl ```hcl
resource "stackit_objectstorage_bucket" "example" { resource "stackit_objectstorage_bucket" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example" name = "example"
} }
resource "stackit_objectstorage_credentials_group" "example" { resource "stackit_objectstorage_credentials_group" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-credentials-group" name = "example-credentials-group"
} }
resource "stackit_objectstorage_credential" "example" { resource "stackit_objectstorage_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
credentials_group_id = stackit_objectstorage_credentials_group.example.credentials_group_id credentials_group_id = stackit_objectstorage_credentials_group.example.credentials_group_id
expiration_timestamp = "2027-01-02T03:04:05Z" expiration_timestamp = "2027-01-02T03:04:05Z"
} }
``` ```
3. **Configure AWS Provider** 3. **Configure AWS Provider**
Configure the AWS Provider to connect to the STACKIT Object Storage bucket. Configure the AWS Provider to connect to the STACKIT Object Storage bucket.
```hcl ```hcl
provider "aws" { provider "aws" {
region = "eu01" region = "eu01"
skip_credentials_validation = true skip_credentials_validation = true
skip_region_validation = true skip_region_validation = true
skip_requesting_account_id = true skip_requesting_account_id = true
access_key = stackit_objectstorage_credential.example.access_key access_key = stackit_objectstorage_credential.example.access_key
secret_key = stackit_objectstorage_credential.example.secret_access_key secret_key = stackit_objectstorage_credential.example.secret_access_key
endpoints { endpoints {
s3 = "https://object.storage.eu01.onstackit.cloud" s3 = "https://object.storage.eu01.onstackit.cloud"
}
} }
} ```
```
4. **Use the provider to manage objects or policies** 4. **Use the provider to manage objects or policies**
```hcl ```hcl
resource "aws_s3_object" "test_file" { resource "aws_s3_object" "test_file" {
bucket = stackit_objectstorage_bucket.example.name bucket = stackit_objectstorage_bucket.example.name
key = "hello_world.txt" key = "hello_world.txt"
source = "files/hello_world.txt" source = "files/hello_world.txt"
content_type = "text/plain" content_type = "text/plain"
etag = filemd5("files/hello_world.txt") etag = filemd5("files/hello_world.txt")
} }
resource "aws_s3_bucket_policy" "allow_public_read_access" { resource "aws_s3_bucket_policy" "allow_public_read_access" {
bucket = stackit_objectstorage_bucket.test20.name bucket = stackit_objectstorage_bucket.test20.name
policy = <<EOF policy = <<EOF
{ {
"Statement":[ "Statement":[
{ {
"Sid": "Public GET", "Sid": "Public GET",
"Effect":"Allow", "Effect":"Allow",
"Principal":"*", "Principal":"*",
"Action":"s3:GetObject", "Action":"s3:GetObject",
"Resource":"urn:sgws:s3:::example/*" "Resource":"urn:sgws:s3:::example/*"
} }
] ]
} }
EOF EOF
} }
``` ```