0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Error 409: Requested entity already exists, alreadyExists

Posted at

解決方法

project_id にユニークなものを指定する
(絶対に正しいかはわからない)

起こったこと

$ terraform apply
.
.
.
google_project.gcp_project: Creating...
╷
│ Error: error creating project {PROJECT_ID} (PROJECT_ID): googleapi: Error 409: Requested entity already exists, alreadyExists. If you received a 403 error, make sure you have the `roles/resourcemanager.projectCreator` permission
│ 
│   with google_project.gcp_project,
│   on main.tf line 10, in resource "google_project" "gcp_project":
│   10: resource "google_project" "gcp_project" {

検証内容

main.tf
resource "google_project" "gcp_project" {
  name                = var.gcp_project
  project_id          = var.gcp_project
  # billing_account     = var.billing_id
  auto_create_network = false
}

最初、billing_account なしで project を作成しようとしてエラーが出て、指定後、再度 apply したらエラーが発生。
という流れだったので、最初に失敗したのが原因だと思って調べていた。
だが、検証するとエラーの発生と作成試行回数に関係はなさそう。
それよりも、project_id のユニークさでエラーの有無が変わることに気づく。
ブラウザの console に行って試してみると、やっぱりユニーク性で引っかかっていそうな気配がした。
ユニークなidでプロジェクト作成を行うようにしてから、Error 409: Requested entity already exists, alreadyExists このエラーは出なくなった。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?