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

🔧 cloud runのv2への移行 / memory limitを設定 #19

Merged
merged 1 commit into from
Apr 15, 2024

Conversation

Shion1305
Copy link
Member

@Shion1305 Shion1305 force-pushed the cloudrun-v2 branch 2 times, most recently from 86902d3 to 9b913d3 Compare April 15, 2024 10:47
Copy link

Plan Result (dev)

CI link

⚠️ Resource Deletion will happen

This plan contains resource delete operation. Please check the plan result very carefully!

Plan: 1 to add, 0 to change, 1 to destroy.
  • Create
    • google_cloud_run_v2_service.cloudrun-dev-main-backend
  • Delete
    • google_cloud_run_service.cloudrun-dev-main-backend
Change Result (Click me)
  # google_cloud_run_service.cloudrun-dev-main-backend will be destroyed
  # (because google_cloud_run_service.cloudrun-dev-main-backend is not in configuration)
  - resource "google_cloud_run_service" "cloudrun-dev-main-backend" {
      - autogenerate_revision_name = false -> null
      - id                         = "locations/asia-northeast1/namespaces/lgtmgen-project/services/dev-main-backend" -> null
      - location                   = "asia-northeast1" -> null
      - name                       = "dev-main-backend" -> null
      - project                    = "lgtmgen-project" -> null
      - status                     = [
          - {
              - conditions                   = [
                  - {
                      - status  = "True"
                      - type    = "Ready"
                        # (2 unchanged attributes hidden)
                    },
                  - {
                      - status  = "True"
                      - type    = "ConfigurationsReady"
                        # (2 unchanged attributes hidden)
                    },
                  - {
                      - status  = "True"
                      - type    = "RoutesReady"
                        # (2 unchanged attributes hidden)
                    },
                ]
              - latest_created_revision_name = "dev-main-backend-00014-flc"
              - latest_ready_revision_name   = "dev-main-backend-00014-flc"
              - observed_generation          = 14
              - traffic                      = [
                  - {
                      - latest_revision = true
                      - percent         = 100
                      - revision_name   = "dev-main-backend-00014-flc"
                        # (2 unchanged attributes hidden)
                    },
                ]
              - url                          = "https://dev-main-backend-vtekrkk7mq-an.a.run.app"
            },
        ] -> null

      - metadata {
          - annotations           = {} -> null
          - effective_annotations = {
              - "run.googleapis.com/client-name"    = "cloud-console"
              - "run.googleapis.com/ingress"        = "all"
              - "run.googleapis.com/ingress-status" = "all"
              - "run.googleapis.com/operation-id"   = "52651b1d-9797-4f5f-b441-0b74d6f95eb9"
              - "serving.knative.dev/creator"       = "[email protected]"
              - "serving.knative.dev/lastModifier"  = "[email protected]"
            } -> null
          - effective_labels      = {
              - "cloud.googleapis.com/location" = "asia-northeast1"
            } -> null
          - generation            = 14 -> null
          - labels                = {} -> null
          - namespace             = "lgtmgen-project" -> null
          - resource_version      = "AAYWCCTJRMU" -> null
          - self_link             = "/apis/serving.knative.dev/v1/namespaces/228944830644/services/dev-main-backend" -> null
          - terraform_labels      = {} -> null
          - uid                   = "e5a8ad04-b9b5-482d-bc88-64e2ad1d37af" -> null
        }

      - template {
          - metadata {
              - annotations      = {
                  - "autoscaling.knative.dev/maxScale"     = "100"
                  - "run.googleapis.com/client-name"       = "cloud-console"
                  - "run.googleapis.com/startup-cpu-boost" = "false"
                } -> null
              - generation       = 0 -> null
              - labels           = {
                  - "client.knative.dev/nonce"            = "d81ff44e-c42a-43b2-8f13-45efee4c450c"
                  - "github_sha"                          = "5eb8e52aa0de02e9e05b2f9b116a69a08eec8c12"
                  - "run.googleapis.com/startupProbeType" = "Default"
                } -> null
                name             = null
                # (4 unchanged attributes hidden)
            }
          - spec {
              - container_concurrency = 80 -> null
              - service_account_name  = "[email protected]" -> null
              - timeout_seconds       = 300 -> null
                # (1 unchanged attribute hidden)

              - containers {
                  - args        = [] -> null
                  - command     = [] -> null
                  - image       = "asia-northeast1-docker.pkg.dev/lgtmgen-project/dev-main/nginx:latest" -> null
                  - name        = "nginx" -> null
                    # (1 unchanged attribute hidden)

                  - ports {
                      - container_port = 80 -> null
                      - name           = "http1" -> null
                        # (1 unchanged attribute hidden)
                    }

                  - resources {
                      - limits   = {
                          - "cpu"    = "1000m"
                          - "memory" = "512Mi"
                        } -> null
                      - requests = {} -> null
                    }

                  - startup_probe {
                      - failure_threshold     = 1 -> null
                      - initial_delay_seconds = 0 -> null
                      - period_seconds        = 240 -> null
                      - timeout_seconds       = 240 -> null

                      - tcp_socket {
                          - port = 80 -> null
                        }
                    }
                }
              - containers {
                  - args        = [] -> null
                  - command     = [] -> null
                  - image       = "asia-northeast1-docker.pkg.dev/lgtmgen-project/dev-main/backend:latest" -> null
                  - name        = "backend" -> null
                    # (1 unchanged attribute hidden)

                  - env {
                      - name  = "PORT" -> null
                      - value = "8080" -> null
                    }

                  - resources {
                      - limits   = {
                          - "cpu"    = "1000m"
                          - "memory" = "256Mi"
                        } -> null
                      - requests = {} -> null
                    }
                }
            }
        }

      - traffic {
          - latest_revision = true -> null
          - percent         = 100 -> null
            # (3 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
        }
    }

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

@Shion1305 Shion1305 merged commit e1ab599 into main Apr 15, 2024
1 check passed
@Shion1305 Shion1305 deleted the cloudrun-v2 branch April 15, 2024 10:51
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]
google_project_service.vision_api: Refreshing state... [id=lgtmgen-project/vision.googleapis.com]
google_project_service.firestore_api: Refreshing state... [id=lgtmgen-project/firestore.googleapis.com]
data.google_iam_policy.noauth: Reading...
google_firestore_database.datastore_mode_database: Refreshing state... [id=projects/lgtmgen-project/databases/(default)]
google_artifact_registry_repository.main-repo: Refreshing state... [id=projects/lgtmgen-project/locations/asia-northeast1/repositories/dev-main]
google_storage_bucket.public_image_bucket: Refreshing state... [id=lgtm-public-image-bucket]
data.google_iam_policy.noauth: Read complete after 0s [id=3450855414]
google_cloud_run_service.cloudrun-dev-main-backend: Refreshing state... [id=locations/asia-northeast1/namespaces/lgtmgen-project/services/dev-main-backend]
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
  - destroy

Terraform will perform the following actions:

  # google_cloud_run_service.cloudrun-dev-main-backend will be destroyed
  # (because google_cloud_run_service.cloudrun-dev-main-backend is not in configuration)
  - resource "google_cloud_run_service" "cloudrun-dev-main-backend" {
      - autogenerate_revision_name = false -> null
      - id                         = "locations/asia-northeast1/namespaces/lgtmgen-project/services/dev-main-backend" -> null
      - location                   = "asia-northeast1" -> null
      - name                       = "dev-main-backend" -> null
      - project                    = "lgtmgen-project" -> null
      - status                     = [
          - {
              - conditions                   = [
                  - {
                      - status  = "True"
                      - type    = "Ready"
                        # (2 unchanged attributes hidden)
                    },
                  - {
                      - status  = "True"
                      - type    = "ConfigurationsReady"
                        # (2 unchanged attributes hidden)
                    },
                  - {
                      - status  = "True"
                      - type    = "RoutesReady"
                        # (2 unchanged attributes hidden)
                    },
                ]
              - latest_created_revision_name = "dev-main-backend-00014-flc"
              - latest_ready_revision_name   = "dev-main-backend-00014-flc"
              - observed_generation          = 14
              - traffic                      = [
                  - {
                      - latest_revision = true
                      - percent         = 100
                      - revision_name   = "dev-main-backend-00014-flc"
                        # (2 unchanged attributes hidden)
                    },
                ]
              - url                          = "https://dev-main-backend-vtekrkk7mq-an.a.run.app"
            },
        ] -> null

      - metadata {
          - annotations           = {} -> null
          - effective_annotations = {
              - "run.googleapis.com/client-name"    = "cloud-console"
              - "run.googleapis.com/ingress"        = "all"
              - "run.googleapis.com/ingress-status" = "all"
              - "run.googleapis.com/operation-id"   = "52651b1d-9797-4f5f-b441-0b74d6f95eb9"
              - "serving.knative.dev/creator"       = "[email protected]"
              - "serving.knative.dev/lastModifier"  = "[email protected]"
            } -> null
          - effective_labels      = {
              - "cloud.googleapis.com/location" = "asia-northeast1"
            } -> null
          - generation            = 14 -> null
          - labels                = {} -> null
          - namespace             = "lgtmgen-project" -> null
          - resource_version      = "AAYWCCTJRMU" -> null
          - self_link             = "/apis/serving.knative.dev/v1/namespaces/228944830644/services/dev-main-backend" -> null
          - terraform_labels      = {} -> null
          - uid                   = "e5a8ad04-b9b5-482d-bc88-64e2ad1d37af" -> null
        }

      - template {
          - metadata {
              - annotations      = {
                  - "autoscaling.knative.dev/maxScale"     = "100"
                  - "run.googleapis.com/client-name"       = "cloud-console"
                  - "run.googleapis.com/startup-cpu-boost" = "false"
                } -> null
              - generation       = 0 -> null
              - labels           = {
                  - "client.knative.dev/nonce"            = "d81ff44e-c42a-43b2-8f13-45efee4c450c"
                  - "github_sha"                          = "5eb8e52aa0de02e9e05b2f9b116a69a08eec8c12"
                  - "run.googleapis.com/startupProbeType" = "Default"
                } -> null
                name             = null
                # (4 unchanged attributes hidden)
            }
          - spec {
              - container_concurrency = 80 -> null
              - service_account_name  = "[email protected]" -> null
              - timeout_seconds       = 300 -> null
                # (1 unchanged attribute hidden)

              - containers {
                  - args        = [] -> null
                  - command     = [] -> null
                  - image       = "asia-northeast1-docker.pkg.dev/lgtmgen-project/dev-main/nginx:latest" -> null
                  - name        = "nginx" -> null
                    # (1 unchanged attribute hidden)

                  - ports {
                      - container_port = 80 -> null
                      - name           = "http1" -> null
                        # (1 unchanged attribute hidden)
                    }

                  - resources {
                      - limits   = {
                          - "cpu"    = "1000m"
                          - "memory" = "512Mi"
                        } -> null
                      - requests = {} -> null
                    }

                  - startup_probe {
                      - failure_threshold     = 1 -> null
                      - initial_delay_seconds = 0 -> null
                      - period_seconds        = 240 -> null
                      - timeout_seconds       = 240 -> null

                      - tcp_socket {
                          - port = 80 -> null
                        }
                    }
                }
              - containers {
                  - args        = [] -> null
                  - command     = [] -> null
                  - image       = "asia-northeast1-docker.pkg.dev/lgtmgen-project/dev-main/backend:latest" -> null
                  - name        = "backend" -> null
                    # (1 unchanged attribute hidden)

                  - env {
                      - name  = "PORT" -> null
                      - value = "8080" -> null
                    }

                  - resources {
                      - limits   = {
                          - "cpu"    = "1000m"
                          - "memory" = "256Mi"
                        } -> null
                      - requests = {} -> null
                    }
                }
            }
        }

      - traffic {
          - latest_revision = true -> null
          - percent         = 100 -> null
            # (3 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
        }
    }

Plan: 1 to add, 0 to change, 1 to destroy.
google_cloud_run_service.cloudrun-dev-main-backend: Destroying... [id=locations/asia-northeast1/namespaces/lgtmgen-project/services/dev-main-backend]
google_cloud_run_v2_service.cloudrun-dev-main-backend: Creating...
google_cloud_run_service.cloudrun-dev-main-backend: Destruction complete after 1s
╷
│ 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