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 visibility timeout to SQS queue #4

Merged
merged 1 commit into from
Jan 26, 2024
Merged

Add visibility timeout to SQS queue #4

merged 1 commit into from
Jan 26, 2024

Conversation

FloRul
Copy link
Owner

@FloRul FloRul commented Jan 26, 2024

No description provided.

@FloRul FloRul merged commit c9c5fd5 into main Jan 26, 2024
1 check passed
Copy link

Terraform Format and Style 🖌success

Terraform Initialization ⚙️success

Terraform Validation 🤖success

Validation Output

Success! The configuration is valid.


Terraform Plan 📖success

Show Plan

terraform
random_pet.secret_name: Refreshing state... [id=strangely-steady-monkfish]
random_password.master: Refreshing state... [id=none]
module.memory.module.lambda_function_container_image.data.aws_caller_identity.current: Reading...
module.inference.module.lambda_function_container_image.data.aws_region.current: Reading...
aws_secretsmanager_secret.password: Refreshing state... [id=arn:aws:secretsmanager:us-east-1:446872271111:secret:vectordb-password-main-strangely-steady-monkfish-dKgTZD]
module.ingestion.module.lambda_function_container_image.aws_cloudwatch_log_group.lambda[0]: Refreshing state... [id=/aws/lambda/levio-demo-fev-ingestion-dev]
module.ingestion.module.lambda_function_container_image.data.aws_partition.current: Reading...
module.ingestion.module.lambda_function_container_image.data.aws_caller_identity.current: Reading...
aws_db_parameter_group.default: Refreshing state... [id=rds-pg]
module.ingestion.aws_sqs_queue.dead_letter_queue: Refreshing state... [id=https://sqs.us-east-1.amazonaws.com/446872271111/levio-demo-fev-ingestion-queue-dev_dead_letter]
module.ingestion.module.lambda_function_container_image.data.aws_partition.current: Read complete after 0s [id=aws]
module.inference.module.lambda_function_container_image.aws_cloudwatch_log_group.lambda[0]: Refreshing state... [id=/aws/lambda/levio-demo-fev-inference-dev]
module.inference.module.lambda_function_container_image.data.aws_region.current: Read complete after 0s [id=us-east-1]
data.aws_ami.latest_amazon_linux: Reading...
module.inference.module.lambda_function_container_image.data.aws_caller_identity.current: Reading...
module.inference.module.lambda_function_container_image.data.aws_iam_policy_document.assume_role[0]: Reading...
module.inference.module.lambda_function_container_image.data.aws_iam_policy_document.assume_role[0]: Read complete after 0s [id=2690255455]
module.memory.aws_dynamodb_table.basic-conversation_memory_table-table: Refreshing state... [id=levio-demo-fev-chat-history-dev]
module.memory.module.lambda_function_container_image.data.aws_caller_identity.current: Read complete after 0s [id=446872271111]
module.ingestion.module.lambda_function_container_image.data.aws_iam_policy_document.assume_role[0]: Reading...
module.ingestion.module.lambda_function_container_image.data.aws_iam_policy_document.assume_role[0]: Read complete after 0s [id=2690255455]
module.memory.module.lambda_function_container_image.data.aws_region.current: Reading...
module.memory.module.lambda_function_container_image.data.aws_region.current: Read complete after 0s [id=us-east-1]
module.inference.module.lambda_function_container_image.data.aws_partition.current: Reading...
module.inference.module.lambda_function_container_image.data.aws_partition.current: Read complete after 0s [id=aws]
module.ingestion.module.lambda_function_container_image.data.aws_region.current: Reading...
module.ingestion.module.lambda_function_container_image.data.aws_region.current: Read complete after 0s [id=us-east-1]
module.memory.module.lambda_function_container_image.aws_cloudwatch_log_group.lambda[0]: Refreshing state... [id=/aws/lambda/levio-demo-fev-memory-dev]
module.ingestion.module.lambda_function_container_image.data.aws_caller_identity.current: Read complete after 0s [id=446872271111]
module.memory.module.lambda_function_container_image.data.aws_partition.current: Reading...
module.memory.module.lambda_function_container_image.data.aws_partition.current: Read complete after 0s [id=aws]
module.vpc.aws_vpc.this[0]: Refreshing state... [id=vpc-00fb300ee2d2f7b3b]
module.inference.module.lambda_function_container_image.data.aws_caller_identity.current: Read complete after 0s [id=446872271111]
module.ingestion.aws_s3_bucket.ingestion_source_storage: Refreshing state... [id=levio-demo-fev-storage-dev]
data.aws_availability_zones.available: Reading...
module.memory.module.lambda_function_container_image.data.aws_iam_policy_document.additional_inline[0]: Reading...
module.memory.module.lambda_function_container_image.data.aws_iam_policy_document.additional_inline[0]: Read complete after 0s [id=3277652423]
module.memory.module.lambda_function_container_image.data.aws_iam_policy_document.assume_role[0]: Reading...
module.memory.module.lambda_function_container_image.data.aws_iam_policy_document.assume_role[0]: Read complete after 0s [id=2690255455]
module.inference.module.lambda_function_container_image.aws_iam_role.lambda[0]: Refreshing state... [id=levio-demo-fev-inference-dev-role]
module.ingestion.module.lambda_function_container_image.aws_iam_role.lambda[0]: Refreshing state... [id=levio-demo-fev-ingestion-dev-role]
aws_secretsmanager_secret_version.password: Refreshing state... [id=arn:aws:secretsmanager:us-east-1:446872271111:secret:vectordb-password-main-strangely-steady-monkfish-dKgTZD|terraform-20240126151709956800000002]
data.aws_ami.latest_amazon_linux: Read complete after 1s [id=ami-046eeba8a7f7bbefd]
data.aws_secretsmanager_secret.password: Reading...
module.memory.module.lambda_function_container_image.aws_iam_policy.additional_inline[0]: Refreshing state... [id=arn:aws:iam::446872271111:policy/levio-demo-fev-memory-dev-role-inline]
module.memory.module.lambda_function_container_image.aws_iam_role.lambda[0]: Refreshing state... [id=levio-demo-fev-memory-dev-role]
module.ingestion.aws_sqs_queue.queue: Refreshing state... [id=https://sqs.us-east-1.amazonaws.com/446872271111/levio-demo-fev-ingestion-queue-dev]
data.aws_availability_zones.available: Read complete after 1s [id=us-east-1]
module.ingestion.module.lambda_function_container_image.data.aws_iam_policy_document.logs[0]: Reading...
module.ingestion.module.lambda_function_container_image.data.aws_iam_policy_document.logs[0]: Read complete after 0s [id=52771042]
module.inference.module.lambda_function_container_image.data.aws_iam_policy_document.logs[0]: Reading...
module.inference.module.lambda_function_container_image.data.aws_iam_policy_document.logs[0]: Read complete after 0s [id=2926739739]
module.ingestion.module.lambda_function_container_image.aws_iam_policy.logs[0]: Refreshing state... [id=arn:aws:iam::446872271111:policy/levio-demo-fev-ingestion-dev-role-logs]
data.aws_secretsmanager_secret.password: Read complete after 0s [id=arn:aws:secretsmanager:us-east-1:446872271111:secret:vectordb-password-main-strangely-steady-monkfish-dKgTZD]
module.memory.module.lambda_function_container_image.data.aws_iam_policy_document.logs[0]: Reading...
module.memory.module.lambda_function_container_image.data.aws_iam_policy_document.logs[0]: Read complete after 0s [id=3522429600]
module.inference.module.lambda_function_container_image.aws_iam_policy.logs[0]: Refreshing state... [id=arn:aws:iam::446872271111:policy/levio-demo-fev-inference-dev-role-logs]
data.aws_secretsmanager_secret_version.password: Reading...
data.aws_secretsmanager_secret_version.password: Read complete after 0s [id=arn:aws:secretsmanager:us-east-1:446872271111:secret:vectordb-password-main-strangely-steady-monkfish-dKgTZD|AWSCURRENT]
module.memory.module.lambda_function_container_image.aws_iam_policy.logs[0]: Refreshing state... [id=arn:aws:iam::446872271111:policy/levio-demo-fev-memory-dev-role-logs]
module.inference.module.lambda_function_container_image.aws_iam_role_policy_attachment.logs[0]: Refreshing state... [id=levio-demo-fev-inference-dev-role-20240126151710029200000003]
module.ingestion.module.lambda_function_container_image.aws_iam_role_policy_attachment.logs[0]: Refreshing state... [id=levio-demo-fev-ingestion-dev-role-20240126151710031000000005]
module.memory.module.lambda_function_container_image.aws_iam_role_policy_attachment.additional_inline[0]: Refreshing state... [id=levio-demo-fev-memory-dev-role-20240126151710029800000004]
module.memory.module.lambda_function_container_image.aws_iam_role_policy_attachment.logs[0]: Refreshing state... [id=levio-demo-fev-memory-dev-role-20240126151710095500000006]
module.vpc.aws_default_route_table.default[0]: Refreshing state... [id=rtb-0b9066ddfe118437e]
module.vpc.aws_default_security_group.this[0]: Refreshing state... [id=sg-0d7ddd92ffe7cad50]
module.vpc.aws_default_network_acl.this[0]: Refreshing state... [id=acl-086b3e733d88fa370]
module.vpc.aws_subnet.database[1]: Refreshing state... [id=subnet-0d1f5f95132e695a6]
module.vpc.aws_subnet.database[0]: Refreshing state... [id=subnet-03f5acb4bc8b5d586]
aws_security_group.lambda_ingestion_sg: Refreshing state... [id=sg-05f52007bac6950c2]
aws_security_group.lambda_memory_sg: Refreshing state... [id=sg-095dd1eeeaae3278f]
module.vpc.aws_route_table.database[0]: Refreshing state... [id=rtb-0f03a46a772c6a571]
module.vpc.aws_internet_gateway.this[0]: Refreshing state... [id=igw-04aae6346ab85dfe5]
module.vpc.aws_route_table.database[1]: Refreshing state... [id=rtb-00ef44a2d775aaa99]
module.vpc.aws_subnet.public[0]: Refreshing state... [id=subnet-09be498e3f465bbb5]
module.vpc.aws_subnet.public[1]: Refreshing state... [id=subnet-0bbe5e0845bba1093]
aws_security_group.jumpbox_sg: Refreshing state... [id=sg-0b9900b5db426c576]
module.vpc.aws_route_table.public[0]: Refreshing state... [id=rtb-02f9981846a152b24]
aws_security_group.lambda_inference_sg: Refreshing state... [id=sg-0b0ddc171bf5034b3]
module.ingestion.aws_sqs_queue_policy.sqs_policy: Refreshing state... [id=https://sqs.us-east-1.amazonaws.com/446872271111/levio-demo-fev-ingestion-queue-dev]
module.vpc.aws_db_subnet_group.database[0]: Refreshing state... [id=ex-terraform-dev]
module.vpc.aws_route_table_association.database[1]: Refreshing state... [id=rtbassoc-0d7135c7f623e06f8]
module.vpc.aws_route_table_association.database[0]: Refreshing state... [id=rtbassoc-044bfd1713e1c30ec]
aws_security_group.dynamo_db_sg: Refreshing state... [id=sg-064b222fa41adf8a4]
aws_vpc_endpoint.lambda_endpoint: Refreshing state... [id=vpce-0baeb867effb860d7]
module.memory.module.lambda_function_container_image.aws_lambda_function.this[0]: Refreshing state... [id=levio-demo-fev-memory-dev]
aws_instance.jumpbox: Refreshing state... [id=i-00e8aa293b50882b6]
module.vpc.aws_route.public_internet_gateway[0]: Refreshing state... [id=r-rtb-02f9981846a152b241080289494]
module.vpc.aws_route_table_association.public[0]: Refreshing state... [id=rtbassoc-0db0a8005c04ca4f2]
module.vpc.aws_route_table_association.public[1]: Refreshing state... [id=rtbassoc-066d9aa6005ec7c94]
aws_security_group.sm_sg: Refreshing state... [id=sg-0420257bd72285220]
aws_security_group.bedrock_sg: Refreshing state... [id=sg-05fee5c54d8dd836b]
aws_security_group.database_sg: Refreshing state... [id=sg-02511ace313a817bd]
aws_vpc_endpoint.s3_endpoint: Refreshing state... [id=vpce-071e9585e30063b9a]
aws_vpc_endpoint.dynamo_db_endpoint: Refreshing state... [id=vpce-02f500d8488580664]
aws_vpc_endpoint.secrets_manager_endpoint: Refreshing state... [id=vpce-0b92742de93a2719b]
aws_vpc_endpoint.bedrock_endpoint: Refreshing state... [id=vpce-0a68a0d1d041b083e]
aws_db_instance.vector_db: Refreshing state... [id=db-KTG3TDKXH3C3BOXFTTIFJ5SASY]
module.inference.module.lambda_function_container_image.data.aws_iam_policy_document.additional_inline[0]: Reading...
module.ingestion.module.lambda_function_container_image.data.aws_iam_policy_document.additional_inline[0]: Reading...
module.inference.module.lambda_function_container_image.data.aws_iam_policy_document.additional_inline[0]: Read complete after 0s [id=242001761]
module.ingestion.module.lambda_function_container_image.data.aws_iam_policy_document.additional_inline[0]: Read complete after 0s [id=2554341540]
module.inference.module.lambda_function_container_image.aws_iam_policy.additional_inline[0]: Refreshing state... [id=arn:aws:iam::446872271111:policy/levio-demo-fev-inference-dev-role-inline]
module.ingestion.module.lambda_function_container_image.aws_iam_policy.additional_inline[0]: Refreshing state... [id=arn:aws:iam::446872271111:policy/levio-demo-fev-ingestion-dev-role-inline]
module.inference.module.lambda_function_container_image.aws_iam_role_policy_attachment.additional_inline[0]: Refreshing state... [id=levio-demo-fev-inference-dev-role-2024012615222187350000000e]
module.ingestion.module.lambda_function_container_image.aws_iam_role_policy_attachment.additional_inline[0]: Refreshing state... [id=levio-demo-fev-ingestion-dev-role-2024012615222186470000000d]
module.inference.module.lambda_function_container_image.aws_lambda_function.this[0]: Refreshing state... [id=levio-demo-fev-inference-dev]
module.ingestion.module.lambda_function_container_image.aws_lambda_function.this[0]: Refreshing state... [id=levio-demo-fev-ingestion-dev]

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

Terraform will perform the following actions:

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

      + statement {
          + actions   = [
              + "sqs:SendMessage",
            ]
          + effect    = "Allow"
          + resources = [
              + "arn:aws:sqs:us-east-1:*:levio-demo-fev-ingestion-queue-dev",
            ]

          + condition {
              + test     = "ArnLike"
              + values   = [
                  + "arn:aws:s3:::levio-demo-fev-storage-dev",
                ]
              + variable = "aws:SourceArn"
            }

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

  # module.ingestion.aws_lambda_event_source_mapping.event_source_mapping will be created
  + resource "aws_lambda_event_source_mapping" "event_source_mapping" {
      + batch_size                    = 1
      + enabled                       = true
      + event_source_arn              = "arn:aws:sqs:us-east-1:446872271111:levio-demo-fev-ingestion-queue-dev"
      + function_arn                  = (known after apply)
      + function_name                 = "levio-demo-fev-ingestion-dev"
      + id                            = (known after apply)
      + last_modified                 = (known after apply)
      + last_processing_result        = (known after apply)
      + maximum_record_age_in_seconds = (known after apply)
      + maximum_retry_attempts        = (known after apply)
      + parallelization_factor        = (known after apply)
      + state                         = (known after apply)
      + state_transition_reason       = (known after apply)
      + uuid                          = (known after apply)
    }

  # module.ingestion.aws_s3_bucket_notification.bucket_notification will be created
  + resource "aws_s3_bucket_notification" "bucket_notification" {
      + bucket      = "levio-demo-fev-storage-dev"
      + eventbridge = false
      + id          = (known after apply)

      + queue {
          + events        = [
              + "s3:ObjectCreated:*",
              + "s3:ObjectRemoved:*",
            ]
          + filter_suffix = ".pdf"
          + id            = (known after apply)
          + queue_arn     = "arn:aws:sqs:us-east-1:446872271111:levio-demo-fev-ingestion-queue-dev"
        }
    }

  # module.ingestion.aws_sqs_queue.queue will be updated in-place
  ~ resource "aws_sqs_queue" "queue" {
        id                                = "https://sqs.us-east-1.amazonaws.com/446872271111/levio-demo-fev-ingestion-queue-dev"
        name                              = "levio-demo-fev-ingestion-queue-dev"
        tags                              = {}
      ~ visibility_timeout_seconds        = 30 -> 500
        # (13 unchanged attributes hidden)
    }

  # module.ingestion.aws_sqs_queue_policy.sqs_policy will be updated in-place
  ~ resource "aws_sqs_queue_policy" "sqs_policy" {
        id        = "https://sqs.us-east-1.amazonaws.com/446872271111/levio-demo-fev-ingestion-queue-dev"
      ~ policy    = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = "sqs:SendMessage"
                      - Condition = {
                          - ArnLike = {
                              - "aws:SourceArn" = "arn:aws:s3:::levio-demo-fev-storage-dev"
                            }
                        }
                      - Effect    = "Allow"
                      - Principal = {
                          - Service = "s3.amazonaws.com"
                        }
                      - Resource  = "arn:aws:sqs:us-east-1:*:levio-demo-fev-ingestion-queue-dev"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> (known after apply)
        # (1 unchanged attribute hidden)
    }

Plan: 2 to add, 2 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: @FloRul, Action: pull_request, Workflow: Infrastructure planning and management

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