diff --git a/README.md b/README.md index 20986533..49a7e08d 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,35 @@ Using this flow is less secure since the token is long-lived. You can provide th 2. Setting the environment variable `STACKIT_SERVICE_ACCOUNT_TOKEN` 3. Setting it in the credentials file (see above) +# Backend configuration + +To keep track of your terraform state, you can configure an [S3 backend](https://developer.hashicorp.com/terraform/language/settings/backends/s3) using [STACKIT Object Storage](https://docs.stackit.cloud/stackit/en/object-storage-s3-compatible-71009778.html). + +To do so, you need an Object Storage [S3 bucket](https://docs.stackit.cloud/stackit/en/basic-concept-objectstorage-71009785.html#BasicConceptObjectStorage-Buckets) and [credentials](https://docs.stackit.cloud/stackit/en/basic-concept-objectstorage-71009785.html#BasicConceptObjectStorage-Credentials) to access it. If you need to create them, check [Getting Started - Object Storage](https://docs.stackit.cloud/stackit/en/getting-started-objectstorage-71009792.html). + +Once you have everything setup, you can configure the backend by adding the following block to your terraform configuration: + +``` +terraform { + backend "s3" { + bucket = "BUCKET_NAME" + key = "path/to/key" + endpoints = { + s3 = "https://object.storage.eu01.onstackit.cloud" + } + region = "eu01" + skip_credentials_validation = true + skip_region_validation = true + skip_s3_checksum = true + skip_requesting_account_id = true + secret_key = "SECRET_KEY" + access_key = "ACCESS_KEY" + } +} +``` + +Note: AWS specific checks must be skipped as they do not work on STACKIT. For details on what those validations do, see [here](https://developer.hashicorp.com/terraform/language/settings/backends/s3#configuration). + # Acceptance Tests Terraform acceptance tests are run using the command `make test-acceptance-tf`. For all services, diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl index 23b59e75..4404ed43 100644 --- a/templates/index.md.tmpl +++ b/templates/index.md.tmpl @@ -81,4 +81,32 @@ Using this flow is less secure since the token is long-lived. You can provide th 2. Setting the environment variable `STACKIT_SERVICE_ACCOUNT_TOKEN` 3. Setting it in the credentials file (see above) +# Backend configuration + +To keep track of your terraform state, you can configure an [S3 backend](https://developer.hashicorp.com/terraform/language/settings/backends/s3) using [STACKIT Object Storage](https://docs.stackit.cloud/stackit/en/object-storage-s3-compatible-71009778.html). + +To do so, you need an Object Storage [S3 bucket](https://docs.stackit.cloud/stackit/en/basic-concept-objectstorage-71009785.html#BasicConceptObjectStorage-Buckets) and [credentials](https://docs.stackit.cloud/stackit/en/basic-concept-objectstorage-71009785.html#BasicConceptObjectStorage-Credentials) to access it. If you need to create them, check [Getting Started - Object Storage](https://docs.stackit.cloud/stackit/en/getting-started-objectstorage-71009792.html). + +Once you have everything setup, you can configure the backend by adding the following block to your terraform configuration: + +``` +terraform { + backend "s3" { + bucket = "BUCKET_NAME" + key = "path/to/key" + endpoints = { + s3 = "https://object.storage.eu01.onstackit.cloud" + } + region = "eu01" + skip_credentials_validation = true + skip_region_validation = true + skip_s3_checksum = true + skip_requesting_account_id = true + secret_key = "SECRET_KEY" + access_key = "ACCESS_KEY" + } +} +``` + +Note: AWS specific checks must be skipped as they do not work on STACKIT. For details on what those validations do, see [here](https://developer.hashicorp.com/terraform/language/settings/backends/s3#configuration). {{ .SchemaMarkdown | trimspace }}