Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 add revision in google_cloud_run_v2_service.traffic #20

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

Shion1305
Copy link
Member

No description provided.

Copy link

Plan Result (dev)

CI link

Plan: 1 to add, 1 to change, 0 to destroy.
  • Create
    • google_cloud_run_v2_service.cloudrun-dev-main-backend
  • Update
    • google_cloud_run_service_iam_policy.noauth
Change Result (Click me)
  # google_cloud_run_service_iam_policy.noauth will be updated in-place
  ~ resource "google_cloud_run_service_iam_policy" "noauth" {
        id          = "v1/projects/lgtmgen-project/locations/asia-northeast1/services/dev-main-backend"
      ~ policy_data = jsonencode(
          ~ {
              + bindings = [
                  + {
                      + members = [
                          + "allUsers",
                        ]
                      + role    = "roles/run.invoker"
                    },
                ]
            }
        )
        # (4 unchanged attributes hidden)
    }

  # google_cloud_run_v2_service.cloudrun-dev-main-backend will be created
  + resource "google_cloud_run_v2_service" "cloudrun-dev-main-backend" {
      + conditions              = (known after apply)
      + create_time             = (known after apply)
      + creator                 = (known after apply)
      + delete_time             = (known after apply)
      + effective_annotations   = (known after apply)
      + effective_labels        = (known after apply)
      + etag                    = (known after apply)
      + expire_time             = (known after apply)
      + generation              = (known after apply)
      + id                      = (known after apply)
      + ingress                 = (known after apply)
      + last_modifier           = (known after apply)
      + latest_created_revision = (known after apply)
      + latest_ready_revision   = (known after apply)
      + launch_stage            = (known after apply)
      + location                = "asia-northeast1"
      + name                    = "dev-main-backend"
      + observed_generation     = (known after apply)
      + project                 = "lgtmgen-project"
      + reconciling             = (known after apply)
      + terminal_condition      = (known after apply)
      + terraform_labels        = (known after apply)
      + traffic_statuses        = (known after apply)
      + uid                     = (known after apply)
      + update_time             = (known after apply)
      + uri                     = (known after apply)

      + template {
          + max_instance_request_concurrency = (known after apply)
          + service_account                  = (known after apply)
          + timeout                          = (known after apply)

          + containers {
              + image = "asia-northeast1-docker.pkg.dev/lgtmgen-project/dev-main/nginx:latest"
              + name  = "nginx"

              + ports {
                  + container_port = 80
                  + name           = (known after apply)
                }

              + resources {
                  + limits = {
                      + "memory" = "1024Mi"
                    }
                }
            }
          + containers {
              + image = "asia-northeast1-docker.pkg.dev/lgtmgen-project/dev-main/backend:latest"
              + name  = "backend"

              + env {
                  + name  = "PORT"
                  + value = "8080"
                }
            }
        }

      + traffic {
          + percent  = 100
          + revision = "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
        }
    }

Plan: 1 to add, 1 to change, 0 to destroy.

@Shion1305 Shion1305 merged commit 1f3fec6 into main Apr 15, 2024
1 check passed
@Shion1305 Shion1305 deleted the cloudrun-v2 branch April 15, 2024 11:02
Copy link

❌ Apply Failed (dev)

CI link

It failed to parse the result.

Details (Click me)
google_firebase_project.default: Refreshing state... [id=projects/lgtmgen-project]
data.google_iam_policy.noauth: Reading...
google_project_service.firestore_api: Refreshing state... [id=lgtmgen-project/firestore.googleapis.com]
google_project_service.vision_api: Refreshing state... [id=lgtmgen-project/vision.googleapis.com]
google_firestore_database.datastore_mode_database: Refreshing state... [id=projects/lgtmgen-project/databases/(default)]
google_storage_bucket.public_image_bucket: Refreshing state... [id=lgtm-public-image-bucket]
google_artifact_registry_repository.main-repo: Refreshing state... [id=projects/lgtmgen-project/locations/asia-northeast1/repositories/dev-main]
data.google_iam_policy.noauth: Read complete after 0s [id=3450855414]
google_cloud_run_service_iam_policy.noauth: Refreshing state... [id=v1/projects/lgtmgen-project/locations/asia-northeast1/services/dev-main-backend]
google_project_service.firebase_database: Refreshing state... [id=lgtmgen-project/firebasedatabase.googleapis.com]
google_firebase_database_instance.default: Refreshing state... [id=projects/lgtmgen-project/locations/asia-southeast1/instances/lgtmgen-project-default-rtdb]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  ~ update in-place

Terraform will perform the following actions:

  # google_cloud_run_service_iam_policy.noauth will be updated in-place
  ~ resource "google_cloud_run_service_iam_policy" "noauth" {
        id          = "v1/projects/lgtmgen-project/locations/asia-northeast1/services/dev-main-backend"
      ~ policy_data = jsonencode(
          ~ {
              + bindings = [
                  + {
                      + members = [
                          + "allUsers",
                        ]
                      + role    = "roles/run.invoker"
                    },
                ]
            }
        )
        # (4 unchanged attributes hidden)
    }

  # google_cloud_run_v2_service.cloudrun-dev-main-backend will be created
  + resource "google_cloud_run_v2_service" "cloudrun-dev-main-backend" {
      + conditions              = (known after apply)
      + create_time             = (known after apply)
      + creator                 = (known after apply)
      + delete_time             = (known after apply)
      + effective_annotations   = (known after apply)
      + effective_labels        = (known after apply)
      + etag                    = (known after apply)
      + expire_time             = (known after apply)
      + generation              = (known after apply)
      + id                      = (known after apply)
      + ingress                 = (known after apply)
      + last_modifier           = (known after apply)
      + latest_created_revision = (known after apply)
      + latest_ready_revision   = (known after apply)
      + launch_stage            = (known after apply)
      + location                = "asia-northeast1"
      + name                    = "dev-main-backend"
      + observed_generation     = (known after apply)
      + project                 = "lgtmgen-project"
      + reconciling             = (known after apply)
      + terminal_condition      = (known after apply)
      + terraform_labels        = (known after apply)
      + traffic_statuses        = (known after apply)
      + uid                     = (known after apply)
      + update_time             = (known after apply)
      + uri                     = (known after apply)

      + template {
          + max_instance_request_concurrency = (known after apply)
          + service_account                  = (known after apply)
          + timeout                          = (known after apply)

          + containers {
              + image = "asia-northeast1-docker.pkg.dev/lgtmgen-project/dev-main/nginx:latest"
              + name  = "nginx"

              + ports {
                  + container_port = 80
                  + name           = (known after apply)
                }

              + resources {
                  + limits = {
                      + "memory" = "1024Mi"
                    }
                }
            }
          + containers {
              + image = "asia-northeast1-docker.pkg.dev/lgtmgen-project/dev-main/backend:latest"
              + name  = "backend"

              + env {
                  + name  = "PORT"
                  + value = "8080"
                }
            }
        }

      + traffic {
          + percent  = 100
          + revision = "TRAFFIC_TARGET_ALLOCATION_TYPE_LATEST"
        }
    }

Plan: 1 to add, 1 to change, 0 to destroy.
google_cloud_run_v2_service.cloudrun-dev-main-backend: Creating...
╷
│ Error: Error creating Service: googleapi: Error 400: Violation in CreateServiceRequest.service.traffic[0].revision: must be specified if and only if traffic type is TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION.
│ Details:
│ [
│   {
│     "@type": "type.googleapis.com/google.rpc.BadRequest",
│     "fieldViolations": [
│       {
│         "description": "must be specified if and only if traffic type is TRAFFIC_TARGET_ALLOCATION_TYPE_REVISION.",
│         "field": "Violation in CreateServiceRequest.service.traffic[0].revision"
│       }
│     ]
│   }
│ ]
│ 
│   with google_cloud_run_v2_service.cloudrun-dev-main-backend,
│   on cloudrun.tf line 1, in resource "google_cloud_run_v2_service" "cloudrun-dev-main-backend":
│    1: resource "google_cloud_run_v2_service" "cloudrun-dev-main-backend" {
│ 
╵
Releasing state lock. This may take a few moments...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant