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

Updates Lambda runtimes to AWS-supported versions #8

Merged
merged 3 commits into from
Jan 27, 2024

Conversation

gcardonag
Copy link
Contributor

Updating runtimes for Lambda functions on AWS to ensure we're running on AWS-supported ones.

Source: https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.htmlx

Copy link

github-actions bot commented Jan 27, 2024

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Validation 🤖success

Validation Output

Success! The configuration is valid.


Terraform Plan 📖success

Show Plan

terraform
data.archive_file.test_results_display: Reading...
data.archive_file.test_page_list: Reading...
data.archive_file.test_page_redirect: Reading...
data.archive_file.test_page_redirect: Read complete after 0s [id=0adc349b710f2c4b423682303f12c68609d502ba]
data.archive_file.test_results_display: Read complete after 0s [id=8a7fcd04975fd6d2dd2932429bfc9c1f54ee041c]
data.archive_file.image_submission_handler: Reading...
data.archive_file.test_page_list: Read complete after 0s [id=719bc4d91300cdb4a7a6d337c5bbad946defadcb]
data.archive_file.image_submission_handler: Read complete after 0s [id=a978e629aa5a75639e57d9a2939ab9739dd0c8cc]
module.beta_site.data.aws_s3_bucket.phlask_images: Reading...
module.beta_site.data.aws_s3_bucket.phlask_logs: Reading...
aws_iam_role.test_page_redirect: Refreshing state... [id=test-page-redirect]
module.prod_site.data.aws_cloudfront_origin_access_identity.images: Reading...
aws_iam_role.test_page_list: Refreshing state... [id=test-page-list]
module.prod_site.aws_s3_bucket.phlask_site: Refreshing state... [id=phlask.me]
module.beta_site.aws_s3_bucket.phlask_site: Refreshing state... [id=beta.phlask.me]
module.test_site.data.aws_s3_bucket.phlask_images: Reading...
data.aws_caller_identity.current: Reading...
data.aws_caller_identity.current: Read complete after 0s [id=710438357722]
module.test_site.data.aws_s3_bucket.phlask_logs: Reading...
aws_s3_bucket.images: Refreshing state... [id=phlask-tap-images]
module.beta_site.data.aws_s3_bucket.phlask_images: Read complete after 0s [id=phlask-tap-images]
module.beta_site.data.aws_cloudfront_origin_access_identity.images: Reading...
module.beta_site.data.aws_s3_bucket.phlask_logs: Read complete after 0s [id=phlask-logs]
module.prod_site.data.aws_s3_bucket.phlask_images: Reading...
module.test_site.data.aws_s3_bucket.phlask_images: Read complete after 0s [id=phlask-tap-images]
module.test_site.aws_s3_bucket.phlask_site: Refreshing state... [id=test.phlask.me]
module.test_site.data.aws_s3_bucket.phlask_logs: Read complete after 0s [id=phlask-logs]
aws_s3_bucket.logs: Refreshing state... [id=phlask-logs]
data.aws_iam_policy.AWSLambdaBasicExecutionRole: Reading...
module.prod_site.data.aws_s3_bucket.phlask_images: Read complete after 0s [id=phlask-tap-images]
data.aws_cloudfront_origin_access_identity.images: Reading...
module.prod_site.data.aws_cloudfront_origin_access_identity.images: Read complete after 0s [id=EYLKT3B3LMJM1]
aws_iam_role.image_submission_handler: Refreshing state... [id=image-submission-handler]
module.test_site.data.aws_cloudfront_origin_access_identity.images: Reading...
data.aws_cloudfront_origin_access_identity.images: Read complete after 0s [id=EYLKT3B3LMJM1]
data.aws_cloudfront_cache_policy.caching_optimized: Reading...
module.beta_site.data.aws_cloudfront_origin_access_identity.images: Read complete after 0s [id=EYLKT3B3LMJM1]
data.aws_cloudfront_origin_request_policy.s3_origin: Reading...
module.test_site.data.aws_cloudfront_origin_access_identity.images: Read complete after 0s [id=EYLKT3B3LMJM1]
module.prod_site.data.aws_s3_bucket.phlask_logs: Reading...
data.aws_cloudfront_cache_policy.caching_optimized: Read complete after 0s [id=658327ea-f89d-4fab-a63d-7e88639e58f6]
aws_cloudfront_function.www_redirect: Refreshing state... [id=www-redirect]
module.beta_site.aws_acm_certificate.phlask_site: Refreshing state... [id=arn:aws:acm:us-east-1:710438357722:certificate/a075f6e8-7b43-4e15-b7b6-777502baf602]
data.aws_cloudfront_origin_request_policy.s3_origin: Read complete after 0s [id=88a5eaf4-2fd4-4709-b370-b4c650ea3fcf]
module.test_site.aws_acm_certificate.phlask_site: Refreshing state... [id=arn:aws:acm:us-east-1:710438357722:certificate/bdba85cb-2e8f-4c5b-94f1-77918e5ae571]
module.prod_site.data.aws_s3_bucket.phlask_logs: Read complete after 0s [id=phlask-logs]
module.storybook_beta_site.data.aws_route53_zone.primary: Reading...
aws_dynamodb_table.test_page_list: Refreshing state... [id=test-page-list]
data.aws_iam_policy.AWSLambdaBasicExecutionRole: Read complete after 0s [id=arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole]
module.storybook_beta_site.aws_acm_certificate.storybook_site: Refreshing state... [id=arn:aws:acm:us-east-1:710438357722:certificate/434c2733-4e04-41c3-8bcd-7827e2b5195b]
module.prod_site.aws_acm_certificate.phlask_site: Refreshing state... [id=arn:aws:acm:us-east-1:710438357722:certificate/ece470f1-c6ab-4d7b-8ab2-19c2fff629df]
module.storybook_beta_site.aws_cloudfront_origin_access_control.storybook_site: Refreshing state... [id=E3DGQ49FSY2HWQ]
module.storybook_beta_site.aws_s3_bucket.storybook_site: Refreshing state... [id=beta.storybook.phlask.me]
aws_iam_policy.test_page_list_dynamodb_access: Refreshing state... [id=arn:aws:iam::710438357722:policy/DynamoDBAccess]
aws_lambda_function.test_page_redirect: Refreshing state... [id=test-page-redirect]
aws_lambda_function.test_page_list: Refreshing state... [id=test-page-list]
module.storybook_beta_site.data.aws_route53_zone.primary: Read complete after 1s [id=Z02971803SR4LWAUUUV9Z]
aws_lambda_function.test_results_display: Refreshing state... [id=test-results-display]
aws_iam_role_policy.test_page_list: Refreshing state... [id=test-page-list:test-bucket-access]
aws_lambda_function.image_submission_handler: Refreshing state... [id=image-submission-handler]
module.prod_site.data.aws_iam_policy_document.phlask_site: Reading...
module.prod_site.data.aws_iam_policy_document.phlask_site: Read complete after 0s [id=3580706049]
module.prod_site.aws_s3_bucket_website_configuration.phlask_site: Refreshing state... [id=phlask.me]
module.prod_site.aws_s3_bucket_acl.phlask_site: Refreshing state... [id=phlask.me,public-read]
module.prod_site.aws_s3_bucket_public_access_block.phlask_site: Refreshing state... [id=phlask.me]
aws_iam_role_policy_attachment.image_submission_handler: Refreshing state... [id=image-submission-handler-arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole]
aws_iam_role_policy_attachment.test_page_redirect: Refreshing state... [id=test-page-redirect-20221126162835357000000001]
aws_iam_role_policy_attachment.test_page_list: Refreshing state... [id=test-page-list-20221126042718794000000004]
module.beta_site.aws_s3_bucket_website_configuration.phlask_site: Refreshing state... [id=beta.phlask.me]
module.beta_site.aws_s3_bucket_public_access_block.phlask_site: Refreshing state... [id=beta.phlask.me]
module.beta_site.aws_s3_bucket_acl.phlask_site: Refreshing state... [id=beta.phlask.me,public-read]
aws_s3_bucket_ownership_controls.logs: Refreshing state... [id=phlask-logs]
module.beta_site.data.aws_iam_policy_document.phlask_site: Reading...
module.beta_site.data.aws_iam_policy_document.phlask_site: Read complete after 0s [id=2073274897]
aws_iam_role_policy.image_submission_handler: Refreshing state... [id=image-submission-handler:bucket_access]
data.aws_iam_policy_document.images: Reading...
data.aws_iam_policy_document.images: Read complete after 0s [id=3328870480]
aws_s3_bucket_acl.images: Refreshing state... [id=phlask-tap-images,private]
aws_s3_bucket_lifecycle_configuration.images: Refreshing state... [id=phlask-tap-images]
module.test_site.aws_s3_bucket_public_access_block.phlask_site: Refreshing state... [id=test.phlask.me]
aws_s3_bucket_cors_configuration.images: Refreshing state... [id=phlask-tap-images]
module.test_site.aws_s3_bucket_website_configuration.phlask_site: Refreshing state... [id=test.phlask.me]
module.test_site.data.aws_iam_policy_document.phlask_site: Reading...
module.test_site.data.aws_iam_policy_document.phlask_site: Read complete after 0s [id=3191198811]
module.test_site.aws_s3_bucket_acl.phlask_site: Refreshing state... [id=test.phlask.me,public-read]
aws_iam_role_policy_attachment.test_page_list_dynamodb_access: Refreshing state... [id=test-page-list-arn:aws:iam::710438357722:policy/DynamoDBAccess]
module.prod_site.aws_s3_bucket_policy.phlask_site: Refreshing state... [id=phlask.me]
module.storybook_beta_site.aws_route53_record.certificate_storybook["beta.storybook.phlask.me"]: Refreshing state... [id=Z02971803SR4LWAUUUV9Z__2679f1d14f712ed94a26b18ac026371d.beta.storybook.phlask.me._CNAME]
module.beta_site.aws_s3_bucket_policy.phlask_site: Refreshing state... [id=beta.phlask.me]
aws_s3_bucket_policy.images: Refreshing state... [id=phlask-tap-images]
module.test_site.aws_s3_bucket_policy.phlask_site: Refreshing state... [id=test.phlask.me]
module.beta_site.aws_cloudfront_distribution.phlask_site: Refreshing state... [id=EYFMESNC9X208]
module.test_site.aws_cloudfront_distribution.phlask_site: Refreshing state... [id=E3IKKIS9LTKQD]
module.storybook_beta_site.aws_acm_certificate_validation.storybook_site: Refreshing state... [id=2023-07-11 23:54:59.899 +0000 UTC]
module.prod_site.aws_cloudfront_distribution.phlask_site: Refreshing state... [id=E1973YRMECWO5I]
module.storybook_beta_site.aws_cloudfront_distribution.storybook_site: Refreshing state... [id=EP4H9YUQNU8IR]
module.storybook_beta_site.aws_route53_record.storybook_site: Refreshing state... [id=Z02971803SR4LWAUUUV9Z_beta.storybook.phlask.me_A]
module.storybook_beta_site.aws_s3_bucket_policy.storybook_site_bucket_policy: Refreshing state... [id=beta.storybook.phlask.me]

Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the
last "terraform apply" which may have affected this plan:

  # module.storybook_beta_site.aws_s3_bucket.storybook_site has changed
  ~ resource "aws_s3_bucket" "storybook_site" {
      ~ bucket_regional_domain_name = "beta.storybook.phlask.me.s3.amazonaws.com" -> "beta.storybook.phlask.me.s3.us-east-1.amazonaws.com"
        id                          = "beta.storybook.phlask.me"
        # (9 unchanged attributes hidden)

        # (3 unchanged blocks hidden)
    }


Unless you have made equivalent changes to your configuration, or ignored the
relevant attributes using ignore_changes, the following plan may include
actions to undo or respond to these changes.

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

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place
 <= read (data resources)

Terraform will perform the following actions:

  # aws_lambda_function.image_submission_handler will be updated in-place
  ~ resource "aws_lambda_function" "image_submission_handler" {
        id                             = "image-submission-handler"
      ~ last_modified                  = "2022-11-26T04:31:40.000+0000" -> (known after apply)
      ~ qualified_arn                  = "arn:aws:lambda:us-east-1:710438357722:function:image-submission-handler:13" -> (known after apply)
      ~ qualified_invoke_arn           = "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:710438357722:function:image-submission-handler:13/invocations" -> (known after apply)
      ~ runtime                        = "nodejs12.x" -> "nodejs20.x"
      ~ source_code_hash               = "T0agKJ73fmMOzz7wfaTZbnJTYzJYjdHJMcsTbaH3LmY=" -> "E4nt/NR9U/l23B04ay+dbt5VQvDYM+xndELH0FYw0rs="
        tags                           = {
            "Terraform" = "true"
        }
      ~ version                        = "13" -> (known after apply)
        # (16 unchanged attributes hidden)

        # (4 unchanged blocks hidden)
    }

  # aws_lambda_function.test_page_list will be updated in-place
  ~ resource "aws_lambda_function" "test_page_list" {
        id                             = "test-page-list"
      ~ qualified_arn                  = "arn:aws:lambda:us-east-1:710438357722:function:test-page-list:19" -> (known after apply)
      ~ qualified_invoke_arn           = "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:710438357722:function:test-page-list:19/invocations" -> (known after apply)
      ~ runtime                        = "python3.7" -> "python3.12"
        tags                           = {
            "Terraform" = "true"
        }
      ~ version                        = "19" -> (known after apply)
        # (18 unchanged attributes hidden)

        # (4 unchanged blocks hidden)
    }

  # aws_lambda_function.test_page_redirect will be updated in-place
  ~ resource "aws_lambda_function" "test_page_redirect" {
        id                             = "test-page-redirect"
      ~ qualified_arn                  = "arn:aws:lambda:us-east-1:710438357722:function:test-page-redirect:3" -> (known after apply)
      ~ qualified_invoke_arn           = "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:710438357722:function:test-page-redirect:3/invocations" -> (known after apply)
      ~ runtime                        = "python3.8" -> "python3.12"
        tags                           = {
            "Terraform" = "true"
        }
      ~ version                        = "3" -> (known after apply)
        # (18 unchanged attributes hidden)

        # (4 unchanged blocks hidden)
    }

  # aws_lambda_function.test_results_display will be updated in-place
  ~ resource "aws_lambda_function" "test_results_display" {
        id                             = "test-results-display"
      ~ qualified_arn                  = "arn:aws:lambda:us-east-1:710438357722:function:test-results-display:6" -> (known after apply)
      ~ qualified_invoke_arn           = "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:710438357722:function:test-results-display:6/invocations" -> (known after apply)
      ~ runtime                        = "python3.7" -> "python3.12"
        tags                           = {
            "Terraform" = "true"
        }
      ~ version                        = "6" -> (known after apply)
        # (18 unchanged attributes hidden)

        # (4 unchanged blocks hidden)
    }

  # module.beta_site.aws_cloudfront_distribution.phlask_site will be updated in-place
  ~ resource "aws_cloudfront_distribution" "phlask_site" {
        id                             = "EYFMESNC9X208"
        tags                           = {
            "Environment" = "beta"
            "Terraform"   = "true"
        }
        # (19 unchanged attributes hidden)

      ~ ordered_cache_behavior {
            # (13 unchanged attributes hidden)

          - lambda_function_association {
              - event_type   = "viewer-request" -> null
              - include_body = false -> null
              - lambda_arn   = "arn:aws:lambda:us-east-1:710438357722:function:image-submission-handler:13" -> null
            }
          + lambda_function_association {
              + event_type   = (known after apply)
              + include_body = (known after apply)
              + lambda_arn   = (known after apply)
            }
        }

        # (6 unchanged blocks hidden)
    }

  # module.prod_site.aws_cloudfront_distribution.phlask_site will be updated in-place
  ~ resource "aws_cloudfront_distribution" "phlask_site" {
        id                             = "E1973YRMECWO5I"
        tags                           = {
            "Environment" = "prod"
            "Terraform"   = "true"
        }
        # (19 unchanged attributes hidden)

      ~ ordered_cache_behavior {
            # (13 unchanged attributes hidden)

          - lambda_function_association {
              - event_type   = "viewer-request" -> null
              - include_body = false -> null
              - lambda_arn   = "arn:aws:lambda:us-east-1:710438357722:function:image-submission-handler:13" -> null
            }
          + lambda_function_association {
              + event_type   = (known after apply)
              + include_body = (known after apply)
              + lambda_arn   = (known after apply)
            }
        }

        # (6 unchanged blocks hidden)
    }

  # module.storybook_beta_site.data.aws_iam_policy_document.storybook_site_iam_policy will be read during apply
  # (depends on a resource or a module with changes pending)
 <= data "aws_iam_policy_document" "storybook_site_iam_policy" {
      + id   = (known after apply)
      + json = (known after apply)

      + statement {
          + actions   = [
              + "s3:GetObject",
            ]
          + effect    = "Allow"
          + resources = [
              + "arn:aws:s3:::beta.storybook.phlask.me/*",
            ]
          + sid       = "AllowCloudFrontServicePrincipalReadOnly"

          + condition {
              + test     = "StringLike"
              + values   = [
                  + "arn:aws:cloudfront::710438357722:distribution/EP4H9YUQNU8IR",
                ]
              + variable = "AWS:SourceArn"
            }

          + principals {
              + identifiers = [
                  + "cloudfront.amazonaws.com",
                ]
              + type        = "Service"
            }
        }
    }

  # module.storybook_beta_site.aws_cloudfront_distribution.storybook_site will be updated in-place
  ~ resource "aws_cloudfront_distribution" "storybook_site" {
        id                             = "EP4H9YUQNU8IR"
        tags                           = {}
        # (20 unchanged attributes hidden)

      - origin {
          - connection_attempts      = 3 -> null
          - connection_timeout       = 10 -> null
          - domain_name              = "beta.storybook.phlask.me.s3.amazonaws.com" -> null
          - origin_access_control_id = "E3DGQ49FSY2HWQ" -> null
          - origin_id                = "s3-beta.storybook.phlask.me" -> null
        }
      + origin {
          + connection_attempts      = 3
          + connection_timeout       = 10
          + domain_name              = "beta.storybook.phlask.me.s3.us-east-1.amazonaws.com"
          + origin_access_control_id = "E3DGQ49FSY2HWQ"
          + origin_id                = "s3-beta.storybook.phlask.me"
        }

        # (3 unchanged blocks hidden)
    }

  # module.storybook_beta_site.aws_s3_bucket_policy.storybook_site_bucket_policy will be updated in-place
  ~ resource "aws_s3_bucket_policy" "storybook_site_bucket_policy" {
        id     = "beta.storybook.phlask.me"
      ~ policy = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "s3:GetObject"
                      - Condition = {
                          - StringLike = {
                              - "AWS:SourceArn" = "arn:aws:cloudfront::710438357722:distribution/EP4H9YUQNU8IR"
                            }
                        }
                      - Effect    = "Allow"
                      - Principal = {
                          - Service = "cloudfront.amazonaws.com"
                        }
                      - Resource  = "arn:aws:s3:::beta.storybook.phlask.me/*"
                      - Sid       = "AllowCloudFrontServicePrincipalReadOnly"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> (known after apply)
        # (1 unchanged attribute hidden)
    }

  # module.test_site.aws_cloudfront_distribution.phlask_site will be updated in-place
  ~ resource "aws_cloudfront_distribution" "phlask_site" {
        id                             = "E3IKKIS9LTKQD"
        tags                           = {
            "Environment" = "test"
            "Terraform"   = "true"
        }
        # (19 unchanged attributes hidden)

      ~ default_cache_behavior {
            # (11 unchanged attributes hidden)

          - lambda_function_association {
              - event_type   = "origin-response" -> null
              - include_body = false -> null
              - lambda_arn   = "arn:aws:lambda:us-east-1:710438357722:function:test-page-redirect:3" -> null
            }
          + lambda_function_association {
              + event_type   = (known after apply)
              + include_body = (known after apply)
              + lambda_arn   = (known after apply)
            }

            # (1 unchanged block hidden)
        }

      ~ ordered_cache_behavior {
            # (12 unchanged attributes hidden)

          - lambda_function_association {
              - event_type   = "viewer-request" -> null
              - include_body = false -> null
              - lambda_arn   = "arn:aws:lambda:us-east-1:710438357722:function:test-page-list:19" -> null
            }
          + lambda_function_association {
              + event_type   = (known after apply)
              + include_body = (known after apply)
              + lambda_arn   = (known after apply)
            }

            # (1 unchanged block hidden)
        }
      ~ ordered_cache_behavior {
            # (12 unchanged attributes hidden)

          - lambda_function_association {
              - event_type   = "viewer-request" -> null
              - include_body = false -> null
              - lambda_arn   = "arn:aws:lambda:us-east-1:710438357722:function:test-results-display:6" -> null
            }
          + lambda_function_association {
              + event_type   = (known after apply)
              + include_body = (known after apply)
              + lambda_arn   = (known after apply)
            }

            # (1 unchanged block hidden)
        }
      ~ ordered_cache_behavior {
            # (13 unchanged attributes hidden)

          - lambda_function_association {
              - event_type   = "viewer-request" -> null
              - include_body = false -> null
              - lambda_arn   = "arn:aws:lambda:us-east-1:710438357722:function:image-submission-handler:13" -> null
            }
          + lambda_function_association {
              + event_type   = (known after apply)
              + include_body = (known after apply)
              + lambda_arn   = (known after apply)
            }
        }

        # (7 unchanged blocks hidden)
    }

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

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

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.

Pusher: @gcardonag, Action: pull_request, Workflow: Terraform Plan

@gcardonag gcardonag merged commit 68fe6fd into main Jan 27, 2024
1 check passed
@gcardonag gcardonag deleted the lambda-version-updates branch January 27, 2024 23:41
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.

1 participant