Add Scaleway IAC configuration with OpenTofu integration and environment setup

This commit is contained in:
2025-04-25 21:21:19 +02:00
parent cc15ff3247
commit bd8bf86227
11 changed files with 253 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
resource "scaleway_object_bucket" "infra_assets" {
name = "a13labs-infra-${var.bucket_suffix}"
project_id = var.scaleway_project_id
region = "fr-par"
}
resource "scaleway_object_bucket_policy" "policy" {
bucket = scaleway_object_bucket.infra_assets.name
policy = jsonencode({
Version = "2023-04-17",
Id = "AllowMachineDownload",
Statement = [
{
Effect = "Allow"
Action = [
"s3:ListBucket",
"s3:GetObject",
]
Principal = "*"
Resource = [
scaleway_object_bucket.infra_assets.name,
"${scaleway_object_bucket.infra_assets.name}/*",
]
Condition = {
IpAddress = {
"aws:SourceIp" = local.instance_ips
}
},
},
{
Effect = "Allow"
Action = [
"s3:*",
]
Principal = {
SCW = "user_id:${var.scaleway_user_id}"
}
Resource = [
scaleway_object_bucket.infra_assets.name,
"${scaleway_object_bucket.infra_assets.name}/*",
]
},
]
})
}