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

Deploy functions from CI. #13

Merged
merged 8 commits into from
May 5, 2023
Merged

Deploy functions from CI. #13

merged 8 commits into from
May 5, 2023

Conversation

raahii
Copy link
Contributor

@raahii raahii commented May 4, 2023

@raahii raahii self-assigned this May 4, 2023
@github-actions
Copy link

github-actions bot commented May 4, 2023

Terraform Format and Style 🖌``

Terraform Initialization ⚙️success

Terraform Plan 📖failure

Terraform Validation 🤖success

Show Plan

Pushed by: @raahii, Action: pull_request

@github-actions
Copy link

github-actions bot commented May 4, 2023

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖failure

Terraform Validation 🤖success

Show Plan

Pushed by: @raahii, Action: pull_request

@github-actions
Copy link

github-actions bot commented May 4, 2023

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖failure

Terraform Validation 🤖success

Show Plan

Pushed by: @raahii, Action: pull_request

@github-actions
Copy link

github-actions bot commented May 4, 2023

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan
data.archive_file.bot: Reading...
data.archive_file.bot: Read complete after 0s [id=6b0c6b621dd1e5557049f77c0ffbc23f983afb85]
data.google_secret_manager_secret_version.line_bot_channel_access_token: Reading...
data.google_secret_manager_secret_version.line_bot_channel_secret: Reading...
data.google_secret_manager_secret_version.line_bot_channel_access_token: Read complete after 0s [id=projects/900543910035/secrets/lineBotChannelAccessToken/versions/1]
data.google_secret_manager_secret_version.line_bot_channel_secret: Read complete after 0s [id=projects/900543910035/secrets/lineBotChannelSecret/versions/1]

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

Terraform will perform the following actions:

  # google_cloudfunctions_function.bot_webhook will be created
  + resource "google_cloudfunctions_function" "bot_webhook" {
      + available_memory_mb           = 128
      + description                   = "Handle LINE Bot webhook"
      + docker_registry               = (known after apply)
      + entry_point                   = "HandleWebhook"
      + environment_variables         = {
          + "CHANNEL_ACCESS_TOKEN" = (sensitive value)
          + "CHANNEL_SECRET"       = (sensitive value)
          + "FE_BASE_URL"          = "https://haraiai.netlify.app"
          + "PACKAGE_BASE_PATH"    = "/workspace/serverless_function_source_code"
          + "PHASE"                = "production"
          + "PROJECT_ID"           = "haraiai"
          + "TZ"                   = "Asia/Tokyo"
        }
      + https_trigger_security_level  = (known after apply)
      + https_trigger_url             = (known after apply)
      + id                            = (known after apply)
      + ingress_settings              = "ALLOW_ALL"
      + max_instances                 = 3
      + min_instances                 = 0
      + name                          = "BotWebhookHandler"
      + project                       = (known after apply)
      + region                        = (known after apply)
      + runtime                       = "go119"
      + service_account_email         = (known after apply)
      + source_archive_bucket         = "haraiai-bucket"
      + source_archive_object         = "func/bot.e718b59cfd22b121e4e7f6306eb2571b.zip"
      + timeout                       = 10
      + trigger_http                  = true
      + vpc_connector_egress_settings = (known after apply)
    }

  # google_cloudfunctions_function_iam_member.webhook_invoker will be created
  + resource "google_cloudfunctions_function_iam_member" "webhook_invoker" {
      + cloud_function = "BotWebhookHandler"
      + etag           = (known after apply)
      + id             = (known after apply)
      + member         = "allUsers"
      + project        = (known after apply)
      + region         = (known after apply)
      + role           = "roles/cloudfunctions.invoker"
    }

  # google_storage_bucket.bucket will be created
  + resource "google_storage_bucket" "bucket" {
      + force_destroy               = false
      + id                          = (known after apply)
      + location                    = "US"
      + name                        = "haraiai-bucket"
      + project                     = (known after apply)
      + public_access_prevention    = (known after apply)
      + self_link                   = (known after apply)
      + storage_class               = "STANDARD"
      + uniform_bucket_level_access = (known after apply)
      + url                         = (known after apply)
    }

  # google_storage_bucket_object.bot will be created
  + resource "google_storage_bucket_object" "bot" {
      + bucket         = "haraiai-bucket"
      + content_type   = (known after apply)
      + crc32c         = (known after apply)
      + detect_md5hash = "different hash"
      + id             = (known after apply)
      + kms_key_name   = (known after apply)
      + md5hash        = (known after apply)
      + media_link     = (known after apply)
      + name           = "func/bot.e718b59cfd22b121e4e7f6306eb2571b.zip"
      + output_name    = (known after apply)
      + self_link      = (known after apply)
      + source         = "tmp/bot.zip"
      + storage_class  = (known after apply)
    }

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

Changes to Outputs:
  + function_bot_webhook_url = (known after apply)

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

Pushed by: @raahii, Action: pull_request

@github-actions
Copy link

github-actions bot commented May 4, 2023

Terraform Initialization ⚙️success

Terraform Plan 📖success

Terraform Validation 🤖success

Show Plan
data.archive_file.bot: Reading...
data.archive_file.bot: Read complete after 0s [id=6b0c6b621dd1e5557049f77c0ffbc23f983afb85]
google_cloudfunctions_function_iam_member.inquiry_invoker: Refreshing state... [id=projects/haraiai/locations/asia-northeast1/functions/NotifyInquiry/roles/cloudfunctions.invoker/allUsers]
google_storage_bucket_object.api: Refreshing state... [id=haraiai-bucket-func/api.cace207e324fde4b8fa4487a4b4814a5.zip]
google_cloudfunctions_function.api_notify_inquiry: Refreshing state... [id=projects/haraiai/locations/asia-northeast1/functions/NotifyInquiry]
google_storage_bucket.bucket: Refreshing state... [id=haraiai-bucket]
data.google_secret_manager_secret_version.line_bot_channel_secret: Reading...
data.google_secret_manager_secret_version.line_bot_channel_access_token: Reading...
google_storage_bucket_object.bot: Refreshing state... [id=haraiai-bucket-func/bot.1d25f818dc0770b2f6eeaefb71171324.zip]
data.google_secret_manager_secret_version.line_bot_channel_access_token: Read complete after 0s [id=projects/900543910035/secrets/lineBotChannelAccessToken/versions/1]
data.google_secret_manager_secret_version.line_bot_channel_secret: Read complete after 0s [id=projects/900543910035/secrets/lineBotChannelSecret/versions/1]
google_cloudfunctions_function.bot_webhook: Refreshing state... [id=projects/haraiai/locations/asia-northeast1/functions/BotWebhookHandler]
google_cloudfunctions_function_iam_member.webhook_invoker: Refreshing state... [id=projects/haraiai/locations/asia-northeast1/functions/BotWebhookHandler/roles/cloudfunctions.invoker/allUsers]

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

Terraform will perform the following actions:

  # google_cloudfunctions_function.api_notify_inquiry will be destroyed
  # (because google_cloudfunctions_function.api_notify_inquiry is not in configuration)
  - resource "google_cloudfunctions_function" "api_notify_inquiry" {
      - available_memory_mb          = 128 -> null
      - description                  = "Handle inquiry from user" -> null
      - docker_registry              = "CONTAINER_REGISTRY" -> null
      - entry_point                  = "NotifyInquiry" -> null
      - environment_variables        = {
          - "FE_BASE_URL"       = "https://haraiai.netlify.app"
          - "LINE_NOTIFY_TOKEN" = (sensitive value)
          - "PHASE"             = "production"
          - "TZ"                = "Asia/Tokyo"
        } -> null
      - https_trigger_security_level = "SECURE_OPTIONAL" -> null
      - https_trigger_url            = "https://asia-northeast1-haraiai.cloudfunctions.net/NotifyInquiry" -> null
      - id                           = "projects/haraiai/locations/asia-northeast1/functions/NotifyInquiry" -> null
      - ingress_settings             = "ALLOW_ALL" -> null
      - labels                       = {} -> null
      - max_instances                = 1 -> null
      - min_instances                = 0 -> null
      - name                         = "NotifyInquiry" -> null
      - project                      = "haraiai" -> null
      - region                       = "asia-northeast1" -> null
      - runtime                      = "go119" -> null
      - service_account_email        = "haraiai@appspot.gserviceaccount.com" -> null
      - source_archive_bucket        = "haraiai-bucket" -> null
      - source_archive_object        = "func/api.cace207e324fde4b8fa4487a4b4814a5.zip" -> null
      - timeout                      = 10 -> null
      - trigger_http                 = true -> null
    }

  # google_cloudfunctions_function.bot_webhook will be updated in-place
  ~ resource "google_cloudfunctions_function" "bot_webhook" {
        id                           = "projects/haraiai/locations/asia-northeast1/functions/BotWebhookHandler"
        name                         = "BotWebhookHandler"
      ~ source_archive_object        = "func/bot.1d25f818dc0770b2f6eeaefb71171324.zip" -> "func/bot.e718b59cfd22b121e4e7f6306eb2571b.zip"
        # (18 unchanged attributes hidden)
    }

  # google_cloudfunctions_function_iam_member.inquiry_invoker will be destroyed
  # (because google_cloudfunctions_function_iam_member.inquiry_invoker is not in configuration)
  - resource "google_cloudfunctions_function_iam_member" "inquiry_invoker" {
      - cloud_function = "projects/haraiai/locations/asia-northeast1/functions/NotifyInquiry" -> null
      - etag           = "BwXgbYuGQvg=" -> null
      - id             = "projects/haraiai/locations/asia-northeast1/functions/NotifyInquiry/roles/cloudfunctions.invoker/allUsers" -> null
      - member         = "allUsers" -> null
      - project        = "haraiai" -> null
      - region         = "asia-northeast1" -> null
      - role           = "roles/cloudfunctions.invoker" -> null
    }

  # google_storage_bucket_object.api will be destroyed
  # (because google_storage_bucket_object.api is not in configuration)
  - resource "google_storage_bucket_object" "api" {
      - bucket           = "haraiai-bucket" -> null
      - content_type     = "application/zip" -> null
      - crc32c           = "h1KWRQ==" -> null
      - detect_md5hash   = "ys4gfjJP3kuPpEh6S0gUpQ==" -> null
      - event_based_hold = false -> null
      - id               = "haraiai-bucket-func/api.cace207e324fde4b8fa4487a4b4814a5.zip" -> null
      - md5hash          = "ys4gfjJP3kuPpEh6S0gUpQ==" -> null
      - media_link       = "https://storage.googleapis.com/download/storage/v1/b/haraiai-bucket/o/func%2Fapi.cace207e324fde4b8fa4487a4b4814a5.zip?generation=1680008467758631&alt=media" -> null
      - metadata         = {} -> null
      - name             = "func/api.cace207e324fde4b8fa4487a4b4814a5.zip" -> null
      - output_name      = "func/api.cace207e324fde4b8fa4487a4b4814a5.zip" -> null
      - self_link        = "https://www.googleapis.com/storage/v1/b/haraiai-bucket/o/func%2Fapi.cace207e324fde4b8fa4487a4b4814a5.zip" -> null
      - source           = "tmp/api.zip" -> null
      - storage_class    = "STANDARD" -> null
      - temporary_hold   = false -> null
    }

  # google_storage_bucket_object.bot must be replaced
-/+ resource "google_storage_bucket_object" "bot" {
      ~ content_type     = "application/zip" -> (known after apply)
      ~ crc32c           = "mHrvyA==" -> (known after apply)
      ~ detect_md5hash   = "HSX4GNwHcLL27q77cRcTJA==" -> "different hash" # forces replacement
      - event_based_hold = false -> null
      ~ id               = "haraiai-bucket-func/bot.1d25f818dc0770b2f6eeaefb71171324.zip" -> (known after apply)
      + kms_key_name     = (known after apply)
      ~ md5hash          = "HSX4GNwHcLL27q77cRcTJA==" -> (known after apply)
      ~ media_link       = "https://storage.googleapis.com/download/storage/v1/b/haraiai-bucket/o/func%2Fbot.1d25f818dc0770b2f6eeaefb71171324.zip?generation=1680008467882660&alt=media" -> (known after apply)
      - metadata         = {} -> null
      ~ name             = "func/bot.1d25f818dc0770b2f6eeaefb71171324.zip" -> "func/bot.e718b59cfd22b121e4e7f6306eb2571b.zip" # forces replacement
      ~ output_name      = "func/bot.1d25f818dc0770b2f6eeaefb71171324.zip" -> (known after apply)
      ~ self_link        = "https://www.googleapis.com/storage/v1/b/haraiai-bucket/o/func%2Fbot.1d25f818dc0770b2f6eeaefb71171324.zip" -> (known after apply)
      ~ storage_class    = "STANDARD" -> (known after apply)
      - temporary_hold   = false -> null
        # (2 unchanged attributes hidden)
    }

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

Changes to Outputs:
  - function_api_inquiry_url = "https://asia-northeast1-haraiai.cloudfunctions.net/NotifyInquiry" -> null

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

Pushed by: @raahii, Action: pull_request

@raahii raahii merged commit 9b438e7 into main May 5, 2023
4 checks passed
@raahii raahii deleted the terraform-deploy-ci branch May 5, 2023 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant