尝试为静态网站创建一个Google存储桶。
provider "google" {
project = "myprojectname-123"
credentials = "${file("storage-admin.json")}"
region = "us-central1"
zone = "us-central1-c"
}
resource "google_storage_bucket" "STANDARD" {
name = "mywebsite.com"
storage_class = "STANDARD"
location = "US"
website {
main_page_suffix = "index.html"
not_found_page = "404.html"
}
}
>地形应用
googleapi:错误403:您尝试创建的存储桶是域名 由其他用户拥有。,禁止
找到了answer的AWS
问:可以从Terraform for Google Cloud创建以存储域为中心的存储/存储桶吗?
答案 0 :(得分:2)
(假设您已经verified the domain mywebsite.com ,并且您是域的所有者)
我可以看到您正在使用服务的帐户凭据创建存储桶:
提供商“ google” {
project =“ myprojectname-123”
凭据=“ $ {file(” storage-admin.json“)}”
region =“ us-central1”
zone =“ us-central1-c”
}
您必须将该服务帐户添加为域的所有者,因为用于创建这些资源的terraform API调用将使用其凭据来创建存储桶。
如果该帐户不在域的所有者列表中,您将收到403以及收到的消息。 Documentation on how to add the service account as an owner。
同样,请确保将服务帐户添加为域所有者,而不是网站所有者。