Skip to content

Attach permissions to Lambda#2

Merged
ana-sher merged 5 commits into
mainfrom
dev
Nov 27, 2025
Merged

Attach permissions to Lambda#2
ana-sher merged 5 commits into
mainfrom
dev

Conversation

@ana-sher

Copy link
Copy Markdown
Owner

Attach permissions to Lambda

@ana-sher ana-sher self-assigned this Nov 27, 2025
@ana-sher ana-sher added the enhancement New feature or request label Nov 27, 2025
@ana-sher ana-sher changed the title dev Attach permissions to Lambda Nov 27, 2025
@github-actions

Copy link
Copy Markdown

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖success

Show Plan

Pusher: @ana-sher, Action: pull_request

@github-actions

Copy link
Copy Markdown

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Plan 📖success

Show Plan
module.docker_image.data.aws_caller_identity.this: Reading...
aws_iam_role.app_role: Refreshing state... [id=climate_app_role]
module.docker_image.data.aws_region.current: Reading...
data.aws_caller_identity.current: Reading...
module.aws_lambda_function.data.aws_caller_identity.current: Reading...
module.docker_image.aws_ecr_repository.this[0]: Refreshing state... [id=climate-analysis]
module.aws_lambda_function.data.aws_iam_policy_document.assume_role[0]: Reading...
module.aws_lambda_function.data.aws_partition.current: Reading...
module.aws_lambda_function.aws_cloudwatch_log_group.lambda[0]: Refreshing state... [id=/aws/lambda/climate_analysis_lambda]
aws_s3_bucket.app_s3: Refreshing state... [id=climate-analysis-bucket]
module.aws_lambda_function.data.aws_partition.current: Read complete after 0s [id=aws]
module.docker_image.data.aws_region.current: Read complete after 0s [id=eu-north-1]
module.aws_lambda_function.data.aws_iam_policy_document.assume_role[0]: Read complete after 0s [id=2690255455]
data.aws_ecr_authorization_token.token: Reading...
module.aws_lambda_function.data.aws_region.current: Reading...
module.aws_lambda_function.data.aws_region.current: Read complete after 0s [id=eu-north-1]
module.aws_lambda_function.aws_iam_role.lambda[0]: Refreshing state... [id=climate_analysis_lambda]
data.aws_caller_identity.current: Read complete after 0s [id=266796786618]
module.docker_image.data.aws_caller_identity.this: Read complete after 0s [id=266796786618]
module.aws_lambda_function.data.aws_caller_identity.current: Read complete after 0s [id=266796786618]
data.aws_ecr_authorization_token.token: Read complete after 1s [id=eu-north-1]
module.aws_lambda_function.data.aws_iam_policy_document.logs[0]: Reading...
module.aws_lambda_function.data.aws_iam_policy_document.logs[0]: Read complete after 0s [id=2008637481]
module.aws_lambda_function.aws_iam_role_policy.logs[0]: Refreshing state... [id=climate_analysis_lambda:climate_analysis_lambda-logs]
module.docker_image.docker_image.this: Refreshing state... [id=sha256:c4b92dc4b563838ec22a9cd5147641bddd60e4a2a5de6dd16b3c11bc4d06decc266796786618.dkr.ecr.eu-north-1.amazonaws.com/climate-analysis:1.0]
module.docker_image.docker_registry_image.this: Refreshing state... [id=sha256:7d88b809600125640d7161d1ab3255e5ab73379c656ddb5c4bc8c781104c8cf2]
aws_s3_bucket_public_access_block.s3_access: Refreshing state... [id=climate-analysis-bucket]
data.aws_iam_policy_document.aws_policy_doc: Reading...
data.aws_iam_policy_document.aws_policy_doc: Read complete after 0s [id=1638820244]
aws_iam_policy.policy: Refreshing state... [id=arn:aws:iam::266796786618:policy/climate_analysis_resources_policy]
aws_iam_role_policy_attachment.app_role_policy_attach: Refreshing state... [id=climate_app_role/arn:aws:iam::266796786618:policy/climate_analysis_resources_policy]

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.docker_image.docker_image.this has been deleted
  - resource "docker_image" "this" {
        id           = "sha256:c4b92dc4b563838ec22a9cd5147641bddd60e4a2a5de6dd16b3c11bc4d06decc266796786618.dkr.ecr.eu-north-1.amazonaws.com/climate-analysis:1.0"
      - image_id     = "sha256:c4b92dc4b563838ec22a9cd5147641bddd60e4a2a5de6dd16b3c11bc4d06decc" -> null
      - name         = "266796786618.dkr.ecr.eu-north-1.amazonaws.com/climate-analysis:1.0" -> null
        # (3 unchanged attributes hidden)

        # (1 unchanged block 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:
  + create
+/- create replacement and then destroy

Terraform will perform the following actions:

  # aws_iam_role_policy_attachment.lambda_basic will be created
  + resource "aws_iam_role_policy_attachment" "lambda_basic" {
      + id         = (known after apply)
      + policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
      + role       = "climate_app_role"
    }

  # aws_iam_role_policy_attachment.lambda_ecr_pull will be created
  + resource "aws_iam_role_policy_attachment" "lambda_ecr_pull" {
      + id         = (known after apply)
      + policy_arn = "arn:aws:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
      + role       = "climate_app_role"
    }

  # module.aws_lambda_function.aws_lambda_function.this[0] will be created
  + resource "aws_lambda_function" "this" {
      + architectures                  = (known after apply)
      + arn                            = (known after apply)
      + code_sha256                    = (known after apply)
      + function_name                  = "climate_analysis_lambda"
      + id                             = (known after apply)
      + image_uri                      = "266796786618.dkr.ecr.eu-north-1.amazonaws.com/climate-analysis:1.0"
      + invoke_arn                     = (known after apply)
      + last_modified                  = (known after apply)
      + memory_size                    = 128
      + package_type                   = "Image"
      + publish                        = false
      + qualified_arn                  = (known after apply)
      + qualified_invoke_arn           = (known after apply)
      + region                         = "eu-north-1"
      + reserved_concurrent_executions = -1
      + role                           = "arn:aws:iam::266796786618:role/climate_analysis_lambda"
      + signing_job_arn                = (known after apply)
      + signing_profile_version_arn    = (known after apply)
      + skip_destroy                   = false
      + source_code_hash               = (known after apply)
      + source_code_size               = (known after apply)
      + tags                           = {
          + "terraform-aws-modules" = "lambda"
        }
      + tags_all                       = {
          + "terraform-aws-modules" = "lambda"
        }
      + timeout                        = 3
      + version                        = (known after apply)
        # (1 unchanged attribute hidden)

      + ephemeral_storage {
          + size = 512
        }

      + logging_config {
          + log_format = "Text"
          + log_group  = (known after apply)
        }

      + tracing_config (known after apply)
    }

  # module.docker_image.docker_image.this will be created
  + resource "docker_image" "this" {
      + force_remove = false
      + id           = (known after apply)
      + image_id     = (known after apply)
      + keep_locally = false
      + name         = "266796786618.dkr.ecr.eu-north-1.amazonaws.com/climate-analysis:1.0"
      + repo_digest  = (known after apply)

      + build {
          + cache_from     = []
          + context        = "../"
          + dockerfile     = "Dockerfile"
          + extra_hosts    = []
          + remove         = true
          + security_opt   = []
          + tag            = []
            # (13 unchanged attributes hidden)
        }
    }

  # module.docker_image.docker_registry_image.this must be replaced
+/- resource "docker_registry_image" "this" {
      ~ id                   = "sha256:7d88b809600125640d7161d1ab3255e5ab73379c656ddb5c4bc8c781104c8cf2" -> (known after apply)
        name                 = "266796786618.dkr.ecr.eu-north-1.amazonaws.com/climate-analysis:1.0"
      ~ sha256_digest        = "sha256:7d88b809600125640d7161d1ab3255e5ab73379c656ddb5c4bc8c781104c8cf2" -> (known after apply)
      ~ triggers             = {
          - "image_id" = "sha256:c4b92dc4b563838ec22a9cd5147641bddd60e4a2a5de6dd16b3c11bc4d06decc"
        } -> (known after apply) # forces replacement
        # (2 unchanged attributes hidden)
    }

Plan: 5 to add, 0 to change, 1 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: @ana-sher, Action: pull_request

@ana-sher ana-sher merged commit ed0c0c9 into main Nov 27, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant