From c3e338c8a9d643c4191aeee218779171da8e9ab5 Mon Sep 17 00:00:00 2001 From: tcarecolin Date: Thu, 24 Jul 2025 11:17:23 +0200 Subject: [PATCH 1/5] add s3 backend documentation --- docs/guides/backend_guide.md | 92 ++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/docs/guides/backend_guide.md b/docs/guides/backend_guide.md index 2e328ed5f..5b29ffe25 100644 --- a/docs/guides/backend_guide.md +++ b/docs/guides/backend_guide.md @@ -177,3 +177,95 @@ data "scaleway_rdb_instance" "mybackend" { name = "your-database-name" } ``` + +## Using s3 compatible backend + +You can use scaleway object-storage bucket as an S3 compatible backend to store your terraform tfstate file just like you would do with AWS s3 + +### by using hardcoded credetials (NOT RECOMENDED) +``` +terraform { + backend "s3" { + bucket = "scw-bucket" + key = "terraform.tfstate" + region = "fr-par" + endpoint = "https://s3.fr-par.scw.cloud" + skip_credentials_validation = true + skip_region_validation = true + skip_requesting_account_id = true + skip_s3_checksum = true + access_key = XXXXXXXXXXX + secert_key = YYYYYYYYYYY + } +} +``` + +### by using credetials environment variables +``` +$ export SCW_ACCESS_KEY="XXXXXXXXXXX" +$ export SCW_SECRET_KEY="YYYYYYYYYYY" +``` +and this simple backend code +``` +terraform { + backend "s3" { + bucket = "scw-bucket" + key = "terraform.tfstate" + region = "fr-par" + endpoint = "https://s3.fr-par.scw.cloud" + } +} +``` + +### and with the shared congfiguration file ? +scaleway scw cli privide you with a credential file +>~/$HOME/.config/scw/config.yaml + +to generate your credential fil you can run scw init at first run or login for every new key pairs generated +``` +scw login +``` + +it wil generat scw shared configuration fil folowinng this format +``` +profiles: + myProfile1: + access_key: XXXXXXXXXXX + secret_key: YYYYYYYYYYY + default_organization_id: example-org-id-zzzzzzzzzz + default_project_id: example-org-id-zzzzzzzzzz + default_zone: fr-par-1 + default_region: fr-par + api_url: https://api.scaleway.com + insecure: false +``` + +actualy terraform backend "s3" is not aware of any other kind of s3 compatible bucket and is by default assuming you ar using aws's S3 service + +so in order to read scw ccredentials, do not try to use `profile = myProfile1` it will not work, unless you copy scw credentials into aws shared configuration file + +>~/$HOME/.aws/credentials + +``` +[scaleway_profile] +aws_access_key_id = XXXXXXXXXXX +aws_secret_access_key = YYYYYYYYYYY +``` +then in your tf backend bloc use this profile as if it waf a aws backend `profile = "scaleway_rofile"` + +``` +terraform { + backend "s3" { + bucket = "scw-bucket" + key = "terraform.tfstate" + region = "fr-par" + endpoint = "https://s3.fr-par.scw.cloud" + skip_credentials_validation = true + skip_region_validation = true + skip_requesting_account_id = true + skip_s3_checksum = true + profile = "scaleway_rofile" + } +} +``` +now run terraform init and backend s3 should be able to use scaleway object storage instead of aws s3 \ No newline at end of file From e4cf23ce90d574fa23b70d32303eae4346105410 Mon Sep 17 00:00:00 2001 From: tcarecolin Date: Thu, 24 Jul 2025 11:46:52 +0200 Subject: [PATCH 2/5] correct typos in text --- docs/guides/backend_guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/backend_guide.md b/docs/guides/backend_guide.md index 5b29ffe25..fbc66b0ef 100644 --- a/docs/guides/backend_guide.md +++ b/docs/guides/backend_guide.md @@ -226,7 +226,7 @@ to generate your credential fil you can run scw init at first run or login for e scw login ``` -it wil generat scw shared configuration fil folowinng this format +it will generate scw shared configuration fil folowinng this format ``` profiles: myProfile1: @@ -268,4 +268,4 @@ terraform { } } ``` -now run terraform init and backend s3 should be able to use scaleway object storage instead of aws s3 \ No newline at end of file +now run terraform init and backend s3 should be able to use scaleway object storage instead of aws s3. From 9d08f97a54a1e9a115ac7d0d08d126a665725095 Mon Sep 17 00:00:00 2001 From: tcarecolin Date: Thu, 24 Jul 2025 16:50:27 +0200 Subject: [PATCH 3/5] fix many typos in my previous commit --- docs/guides/backend_guide.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/guides/backend_guide.md b/docs/guides/backend_guide.md index fbc66b0ef..e49a7d736 100644 --- a/docs/guides/backend_guide.md +++ b/docs/guides/backend_guide.md @@ -180,9 +180,9 @@ data "scaleway_rdb_instance" "mybackend" { ## Using s3 compatible backend -You can use scaleway object-storage bucket as an S3 compatible backend to store your terraform tfstate file just like you would do with AWS s3 +You can use scaleway object-storage bucket as an S3 compatible backend to store your terraform .tfstate file just like you would do with AWS s3 -### by using hardcoded credetials (NOT RECOMENDED) +### by using hardcoded credetials (NOT RECOMMENDED) ``` terraform { backend "s3" { @@ -200,7 +200,7 @@ terraform { } ``` -### by using credetials environment variables +### by using credentials environment variables ``` $ export SCW_ACCESS_KEY="XXXXXXXXXXX" $ export SCW_SECRET_KEY="YYYYYYYYYYY" @@ -218,15 +218,15 @@ terraform { ``` ### and with the shared congfiguration file ? -scaleway scw cli privide you with a credential file +scaleway scw-cli provide you with a credential file >~/$HOME/.config/scw/config.yaml -to generate your credential fil you can run scw init at first run or login for every new key pairs generated +to generate your credential file you can run scw init at first run or login for every new key pairs generated ``` scw login ``` -it will generate scw shared configuration fil folowinng this format +it will generate scw shared configuration file folowinng this format ``` profiles: myProfile1: @@ -242,7 +242,7 @@ profiles: actualy terraform backend "s3" is not aware of any other kind of s3 compatible bucket and is by default assuming you ar using aws's S3 service -so in order to read scw ccredentials, do not try to use `profile = myProfile1` it will not work, unless you copy scw credentials into aws shared configuration file +so in order to read scw ccredentials, do not try to use `profile = myProfile1` it will not work, unless you can copy your scw credentials into aws shared configuration file >~/$HOME/.aws/credentials @@ -268,4 +268,4 @@ terraform { } } ``` -now run terraform init and backend s3 should be able to use scaleway object storage instead of aws s3. +now run terraform init and the s3 backend should be able to use scaleway object storage instead of aws s3. From 0842cb4d3be73d4cf4fd8cc677f799fbfd25b334 Mon Sep 17 00:00:00 2001 From: tcarecolin Date: Thu, 24 Jul 2025 17:03:22 +0200 Subject: [PATCH 4/5] markdown lint fixes --- docs/guides/backend_guide.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/guides/backend_guide.md b/docs/guides/backend_guide.md index e49a7d736..0bf6b4c6c 100644 --- a/docs/guides/backend_guide.md +++ b/docs/guides/backend_guide.md @@ -183,6 +183,7 @@ data "scaleway_rdb_instance" "mybackend" { You can use scaleway object-storage bucket as an S3 compatible backend to store your terraform .tfstate file just like you would do with AWS s3 ### by using hardcoded credetials (NOT RECOMMENDED) + ``` terraform { backend "s3" { @@ -201,11 +202,14 @@ terraform { ``` ### by using credentials environment variables + ``` $ export SCW_ACCESS_KEY="XXXXXXXXXXX" $ export SCW_SECRET_KEY="YYYYYYYYYYY" ``` + and this simple backend code + ``` terraform { backend "s3" { @@ -217,16 +221,18 @@ terraform { } ``` -### and with the shared congfiguration file ? -scaleway scw-cli provide you with a credential file +### and with the shared congfiguration file ? +scaleway scw-cli provide you with a credential file >~/$HOME/.config/scw/config.yaml to generate your credential file you can run scw init at first run or login for every new key pairs generated + ``` scw login ``` it will generate scw shared configuration file folowinng this format + ``` profiles: myProfile1: @@ -251,6 +257,7 @@ so in order to read scw ccredentials, do not try to use `profile = myProfile1` i aws_access_key_id = XXXXXXXXXXX aws_secret_access_key = YYYYYYYYYYY ``` + then in your tf backend bloc use this profile as if it waf a aws backend `profile = "scaleway_rofile"` ``` @@ -268,4 +275,5 @@ terraform { } } ``` + now run terraform init and the s3 backend should be able to use scaleway object storage instead of aws s3. From aace943c3ef0e00d13b02d46e061837209479f24 Mon Sep 17 00:00:00 2001 From: tcarecolin Date: Thu, 24 Jul 2025 17:04:49 +0200 Subject: [PATCH 5/5] mispell --error -source text docs --- docs/guides/backend_guide.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/backend_guide.md b/docs/guides/backend_guide.md index 0bf6b4c6c..7a163477c 100644 --- a/docs/guides/backend_guide.md +++ b/docs/guides/backend_guide.md @@ -246,9 +246,9 @@ profiles: insecure: false ``` -actualy terraform backend "s3" is not aware of any other kind of s3 compatible bucket and is by default assuming you ar using aws's S3 service +actually terraform backend "s3" is not aware of any other kind of s3 compatible bucket and is by default assuming you ar using aws's S3 service -so in order to read scw ccredentials, do not try to use `profile = myProfile1` it will not work, unless you can copy your scw credentials into aws shared configuration file +so in order to read scw credentials, do not try to use `profile = myProfile1` it will not work, unless you can copy your scw credentials into aws shared configuration file >~/$HOME/.aws/credentials