使用 Terraform 为 GCS 启用“互操作”访问?

Rob*_*dan 5 google-cloud-storage google-cloud-platform terraform

是否可以使用 Terraform 启用对 GCS 的 s3 兼容访问并生成/检索密钥对?

帮助说明:

互操作性 API 可让您使用 HMAC 身份验证,并让 Cloud Storage 与为其他云存储系统编写的工具进行互操作。仅当您需要当前用户的互操作访问权限时才启用此 API。此 API 是针对每个项目成员启用的,而不是针对每个项目启用的。每个成员都可以设置默认项目并维护自己的访问密钥。

这让我相信这将是用户的属性,而不是存储子系统的属性。我在 TF、gcloud 或 API 文档中找不到任何内容。

提前致谢

thu*_*soy 1

是的,创建一个应使用互操作性 API 的服务帐户,然后创建一个google_storage_hmac_key

resource "google_service_account" "test" {
  account_id = "interop-test"
}

resource "google_storage_hmac_key" "test" {
  service_account_email = google_service_account.test.email
}

output "access_key" {
  value = google_storage_hmac_key.test.access_id
}

output "secret_key" {
  value     = google_storage_hmac_key.test.secret
  sensitive = true
}
Run Code Online (Sandbox Code Playgroud)