Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add Amazon MQ event source type support #190

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

Conversation

@Infra-Red
Copy link
Contributor

@Infra-Red Infra-Red commented Aug 17, 2021

Description

Allow to configure queues and source_access_configuration properties in lambda_event_source_mapping configuration.

https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-function-mq.html

Motivation and Context

Add missing parameters that are required to configure AmazonMQ event source type.

Breaking Changes

None.

How Has This Been Tested?

Tested locally by modifying the examples/event-source-mapping module to include Amazon MQ event source.

@Infra-Red Infra-Red changed the title (削除) Source access configuration (削除ここまで) (追記) Add Amazon MQ event source type support (追記ここまで) Aug 17, 2021
Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Please update code in examples/event-source-mapping to show this feature for real.

@antonbabenko antonbabenko changed the title (削除) Add Amazon MQ event source type support (削除ここまで) (追記) feat: Add Amazon MQ event source type support (追記ここまで) Aug 19, 2021
Copy link
Contributor Author

Updated with an Amazon MQ event source mapping example.

Copy link
Member

The example looks good but I can't make it to work locally and I don't have a lot of time today to investigate it.

Could you try to run that one example yourself locally?

Copy link
Contributor Author

Hi @antonbabenko, please find the result of terraform plan and terraform apply below.

1. terraform plan
> terraform plan -out .plan
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
 + create
 <= read (data resources)
Terraform will perform the following actions:
 # aws_dynamodb_table.this will be created
 + resource "aws_dynamodb_table" "this" {
 + arn = (known after apply)
 + billing_mode = "PAY_PER_REQUEST"
 + hash_key = "UserId"
 + id = (known after apply)
 + name = (known after apply)
 + range_key = "GameTitle"
 + stream_arn = (known after apply)
 + stream_enabled = true
 + stream_label = (known after apply)
 + stream_view_type = "NEW_AND_OLD_IMAGES"
 + tags_all = (known after apply)
 + attribute {
 + name = "GameTitle"
 + type = "S"
 }
 + attribute {
 + name = "UserId"
 + type = "S"
 }
 + point_in_time_recovery {
 + enabled = (known after apply)
 }
 + server_side_encryption {
 + enabled = (known after apply)
 + kms_key_arn = (known after apply)
 }
 }
 # aws_kinesis_stream.this will be created
 + resource "aws_kinesis_stream" "this" {
 + arn = (known after apply)
 + encryption_type = "NONE"
 + enforce_consumer_deletion = false
 + id = (known after apply)
 + name = (known after apply)
 + retention_period = 24
 + shard_count = 1
 + tags_all = (known after apply)
 }
 # aws_mq_broker.this will be created
 + resource "aws_mq_broker" "this" {
 + apply_immediately = false
 + arn = (known after apply)
 + authentication_strategy = (known after apply)
 + auto_minor_version_upgrade = false
 + broker_name = (known after apply)
 + deployment_mode = "SINGLE_INSTANCE"
 + engine_type = "RabbitMQ"
 + engine_version = "3.8.17"
 + host_instance_type = "mq.t3.micro"
 + id = (known after apply)
 + instances = (known after apply)
 + publicly_accessible = false
 + storage_type = (known after apply)
 + subnet_ids = (known after apply)
 + tags_all = (known after apply)
 + configuration {
 + id = (known after apply)
 + revision = (known after apply)
 }
 + maintenance_window_start_time {
 + day_of_week = (known after apply)
 + time_of_day = (known after apply)
 + time_zone = (known after apply)
 }
 + user {
 # At least one attribute in this block is (or was) sensitive,
 # so its contents will not be displayed.
 }
 }
 # aws_secretsmanager_secret.this will be created
 + resource "aws_secretsmanager_secret" "this" {
 + arn = (known after apply)
 + force_overwrite_replica_secret = false
 + id = (known after apply)
 + name = (known after apply)
 + name_prefix = (known after apply)
 + policy = (known after apply)
 + recovery_window_in_days = 30
 + rotation_enabled = (known after apply)
 + rotation_lambda_arn = (known after apply)
 + tags_all = (known after apply)
 + replica {
 + kms_key_id = (known after apply)
 + last_accessed_date = (known after apply)
 + region = (known after apply)
 + status = (known after apply)
 + status_message = (known after apply)
 }
 + rotation_rules {
 + automatically_after_days = (known after apply)
 }
 }
 # aws_secretsmanager_secret_version.this will be created
 + resource "aws_secretsmanager_secret_version" "this" {
 + arn = (known after apply)
 + id = (known after apply)
 + secret_id = (known after apply)
 + secret_string = (sensitive value)
 + version_id = (known after apply)
 + version_stages = (known after apply)
 }
 # aws_sqs_queue.failure will be created
 + resource "aws_sqs_queue" "failure" {
 + arn = (known after apply)
 + content_based_deduplication = false
 + deduplication_scope = (known after apply)
 + delay_seconds = 0
 + fifo_queue = false
 + fifo_throughput_limit = (known after apply)
 + id = (known after apply)
 + kms_data_key_reuse_period_seconds = (known after apply)
 + max_message_size = 262144
 + message_retention_seconds = 345600
 + name = (known after apply)
 + name_prefix = (known after apply)
 + policy = (known after apply)
 + receive_wait_time_seconds = 0
 + tags_all = (known after apply)
 + url = (known after apply)
 + visibility_timeout_seconds = 30
 }
 # aws_sqs_queue.this will be created
 + resource "aws_sqs_queue" "this" {
 + arn = (known after apply)
 + content_based_deduplication = false
 + deduplication_scope = (known after apply)
 + delay_seconds = 0
 + fifo_queue = false
 + fifo_throughput_limit = (known after apply)
 + id = (known after apply)
 + kms_data_key_reuse_period_seconds = (known after apply)
 + max_message_size = 262144
 + message_retention_seconds = 345600
 + name = (known after apply)
 + name_prefix = (known after apply)
 + policy = (known after apply)
 + receive_wait_time_seconds = 0
 + tags_all = (known after apply)
 + url = (known after apply)
 + visibility_timeout_seconds = 30
 }
 # random_password.this will be created
 + resource "random_password" "this" {
 + id = (known after apply)
 + length = 40
 + lower = true
 + min_lower = 0
 + min_numeric = 0
 + min_special = 0
 + min_upper = 0
 + number = true
 + result = (sensitive value)
 + special = false
 + upper = true
 }
 # random_pet.this will be created
 + resource "random_pet" "this" {
 + id = (known after apply)
 + length = 2
 + separator = "-"
 }
 # module.lambda_function.data.aws_iam_policy_document.additional_inline[0] will be read during apply
 # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "additional_inline" {
 + id = (known after apply)
 + json = (known after apply)
 + statement {
 + actions = [
 + "mq:DescribeBroker",
 ]
 + effect = "Allow"
 + resources = [
 + (known after apply),
 ]
 + sid = "mqdescribebroker"
 }
 + statement {
 + actions = [
 + "ec2:DescribeSecurityGroups",
 + "ec2:DescribeSubnets",
 + "ec2:DescribeVpcs",
 ]
 + effect = "Allow"
 + resources = [
 + "*",
 ]
 + sid = "mqeventsource"
 }
 + statement {
 + actions = [
 + "secretsmanager:GetSecretValue",
 ]
 + effect = "Allow"
 + resources = [
 + (known after apply),
 ]
 + sid = "secretsmanagergetvalue"
 }
 + statement {
 + actions = [
 + "sqs:SendMessage",
 ]
 + effect = "Allow"
 + resources = [
 + (known after apply),
 ]
 + sid = "sqsfailure"
 }
 }
 # module.lambda_function.data.aws_iam_policy_document.logs[0] will be read during apply
 # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "logs" {
 + id = (known after apply)
 + json = (known after apply)
 + statement {
 + actions = [
 + "logs:CreateLogGroup",
 + "logs:CreateLogStream",
 + "logs:PutLogEvents",
 ]
 + effect = "Allow"
 + resources = [
 + (known after apply),
 + (known after apply),
 ]
 }
 }
 # module.lambda_function.aws_cloudwatch_log_group.lambda[0] will be created
 + resource "aws_cloudwatch_log_group" "lambda" {
 + arn = (known after apply)
 + id = (known after apply)
 + name = (known after apply)
 + retention_in_days = 0
 + tags_all = (known after apply)
 }
 # module.lambda_function.aws_iam_policy.additional_inline[0] will be created
 + resource "aws_iam_policy" "additional_inline" {
 + arn = (known after apply)
 + id = (known after apply)
 + name = (known after apply)
 + path = "/"
 + policy = (known after apply)
 + policy_id = (known after apply)
 + tags_all = (known after apply)
 }
 # module.lambda_function.aws_iam_policy.logs[0] will be created
 + resource "aws_iam_policy" "logs" {
 + arn = (known after apply)
 + id = (known after apply)
 + name = (known after apply)
 + path = "/"
 + policy = (known after apply)
 + policy_id = (known after apply)
 + tags_all = (known after apply)
 }
 # module.lambda_function.aws_iam_policy.vpc[0] will be created
 + resource "aws_iam_policy" "vpc" {
 + arn = (known after apply)
 + id = (known after apply)
 + name = (known after apply)
 + path = "/"
 + policy = jsonencode(
 {
 + Statement = [
 + {
 + Action = [
 + "ec2:CreateNetworkInterface",
 + "ec2:DescribeNetworkInterfaces",
 + "ec2:DeleteNetworkInterface",
 + "ec2:AssignPrivateIpAddresses",
 + "ec2:UnassignPrivateIpAddresses",
 ]
 + Effect = "Allow"
 + Resource = "*"
 },
 ]
 + Version = "2012年10月17日"
 }
 )
 + policy_id = (known after apply)
 + tags_all = (known after apply)
 }
 # module.lambda_function.aws_iam_policy_attachment.additional_inline[0] will be created
 + resource "aws_iam_policy_attachment" "additional_inline" {
 + id = (known after apply)
 + name = (known after apply)
 + policy_arn = (known after apply)
 + roles = (known after apply)
 }
 # module.lambda_function.aws_iam_policy_attachment.logs[0] will be created
 + resource "aws_iam_policy_attachment" "logs" {
 + id = (known after apply)
 + name = (known after apply)
 + policy_arn = (known after apply)
 + roles = (known after apply)
 }
 # module.lambda_function.aws_iam_policy_attachment.vpc[0] will be created
 + resource "aws_iam_policy_attachment" "vpc" {
 + id = (known after apply)
 + name = (known after apply)
 + policy_arn = (known after apply)
 + roles = (known after apply)
 }
 # module.lambda_function.aws_iam_role.lambda[0] will be created
 + resource "aws_iam_role" "lambda" {
 + arn = (known after apply)
 + assume_role_policy = jsonencode(
 {
 + Statement = [
 + {
 + Action = "sts:AssumeRole"
 + Effect = "Allow"
 + Principal = {
 + Service = "lambda.amazonaws.com"
 }
 + Sid = ""
 },
 ]
 + Version = "2012年10月17日"
 }
 )
 + create_date = (known after apply)
 + force_detach_policies = true
 + id = (known after apply)
 + managed_policy_arns = (known after apply)
 + max_session_duration = 3600
 + name = (known after apply)
 + path = "/"
 + tags_all = (known after apply)
 + unique_id = (known after apply)
 + inline_policy {
 + name = (known after apply)
 + policy = (known after apply)
 }
 }
 # module.lambda_function.aws_iam_role_policy_attachment.additional_many[0] will be created
 + resource "aws_iam_role_policy_attachment" "additional_many" {
 + id = (known after apply)
 + policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaSQSQueueExecutionRole"
 + role = (known after apply)
 }
 # module.lambda_function.aws_iam_role_policy_attachment.additional_many[1] will be created
 + resource "aws_iam_role_policy_attachment" "additional_many" {
 + id = (known after apply)
 + policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaDynamoDBExecutionRole"
 + role = (known after apply)
 }
 # module.lambda_function.aws_iam_role_policy_attachment.additional_many[2] will be created
 + resource "aws_iam_role_policy_attachment" "additional_many" {
 + id = (known after apply)
 + policy_arn = "arn:aws:iam::aws:policy/service-role/AWSLambdaKinesisExecutionRole"
 + role = (known after apply)
 }
 # module.lambda_function.aws_lambda_event_source_mapping.this["dynamodb"] will be created
 + resource "aws_lambda_event_source_mapping" "this" {
 + enabled = true
 + event_source_arn = (known after apply)
 + function_arn = (known after apply)
 + function_name = (known after apply)
 + 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)
 + starting_position = "LATEST"
 + state = (known after apply)
 + state_transition_reason = (known after apply)
 + uuid = (known after apply)
 + destination_config {
 + on_failure {
 + destination_arn = (known after apply)
 }
 }
 }
 # module.lambda_function.aws_lambda_event_source_mapping.this["kinesis"] will be created
 + resource "aws_lambda_event_source_mapping" "this" {
 + enabled = true
 + event_source_arn = (known after apply)
 + function_arn = (known after apply)
 + function_name = (known after apply)
 + 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)
 + starting_position = "LATEST"
 + state = (known after apply)
 + state_transition_reason = (known after apply)
 + uuid = (known after apply)
 }
 # module.lambda_function.aws_lambda_event_source_mapping.this["mq"] will be created
 + resource "aws_lambda_event_source_mapping" "this" {
 + enabled = true
 + event_source_arn = (known after apply)
 + function_arn = (known after apply)
 + function_name = (known after apply)
 + 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)
 + queues = [
 + "my-queue",
 ]
 + state = (known after apply)
 + state_transition_reason = (known after apply)
 + uuid = (known after apply)
 + source_access_configuration {
 + type = "BASIC_AUTH"
 + uri = (known after apply)
 }
 }
 # module.lambda_function.aws_lambda_event_source_mapping.this["sqs"] will be created
 + resource "aws_lambda_event_source_mapping" "this" {
 + enabled = true
 + event_source_arn = (known after apply)
 + function_arn = (known after apply)
 + function_name = (known after apply)
 + 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.lambda_function.aws_lambda_function.this[0] will be created
 + resource "aws_lambda_function" "this" {
 + arn = (known after apply)
 + filename = "builds/09df5667aa77260cb0bac734adccae8d859ac1b014db638db32448b8068cae7c.zip"
 + function_name = (known after apply)
 + handler = "index.lambda_handler"
 + id = (known after apply)
 + invoke_arn = (known after apply)
 + last_modified = (known after apply)
 + memory_size = 128
 + package_type = "Zip"
 + publish = false
 + qualified_arn = (known after apply)
 + reserved_concurrent_executions = -1
 + role = (known after apply)
 + runtime = "python3.8"
 + signing_job_arn = (known after apply)
 + signing_profile_version_arn = (known after apply)
 + source_code_hash = "YZ7bP6ofV1EOv34MCe0wMZbZEaJffERwzSGjA6FAzZc="
 + source_code_size = (known after apply)
 + tags_all = (known after apply)
 + timeout = 3
 + version = (known after apply)
 + tracing_config {
 + mode = (known after apply)
 }
 }
 # module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["dynamodb"] will be created
 + resource "aws_lambda_permission" "unqualified_alias_triggers" {
 + action = "lambda:InvokeFunction"
 + function_name = (known after apply)
 + id = (known after apply)
 + principal = "dynamodb.amazonaws.com"
 + source_arn = (known after apply)
 + statement_id = "dynamodb"
 }
 # module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["kinesis"] will be created
 + resource "aws_lambda_permission" "unqualified_alias_triggers" {
 + action = "lambda:InvokeFunction"
 + function_name = (known after apply)
 + id = (known after apply)
 + principal = "kinesis.amazonaws.com"
 + source_arn = (known after apply)
 + statement_id = "kinesis"
 }
 # module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["mq"] will be created
 + resource "aws_lambda_permission" "unqualified_alias_triggers" {
 + action = "lambda:InvokeFunction"
 + function_name = (known after apply)
 + id = (known after apply)
 + principal = "mq.amazonaws.com"
 + source_arn = (known after apply)
 + statement_id = "mq"
 }
 # module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["sqs"] will be created
 + resource "aws_lambda_permission" "unqualified_alias_triggers" {
 + action = "lambda:InvokeFunction"
 + function_name = (known after apply)
 + id = (known after apply)
 + principal = "sqs.amazonaws.com"
 + source_arn = (known after apply)
 + statement_id = "sqs"
 }
 # module.lambda_function.local_file.archive_plan[0] will be created
 + resource "local_file" "archive_plan" {
 + content = jsonencode(
 {
 + artifacts_dir = "builds"
 + build_plan = [
 + [
 + "pip",
 + "python3.8",
 + "./../fixtures/python3.8-app1/requirements.txt",
 + null,
 ],
 + [
 + "zip",
 + "./../fixtures/python3.8-app1",
 + null,
 ],
 ]
 + filename = "builds/09df5667aa77260cb0bac734adccae8d859ac1b014db638db32448b8068cae7c.zip"
 + runtime = "python3.8"
 }
 )
 + directory_permission = "0755"
 + file_permission = "0644"
 + filename = "builds/09df5667aa77260cb0bac734adccae8d859ac1b014db638db32448b8068cae7c.plan.json"
 + id = (known after apply)
 }
 # module.lambda_function.null_resource.archive[0] will be created
 + resource "null_resource" "archive" {
 + id = (known after apply)
 + triggers = {
 + "filename" = "builds/09df5667aa77260cb0bac734adccae8d859ac1b014db638db32448b8068cae7c.zip"
 + "timestamp" = "1629384553954721000"
 }
 }
Plan: 31 to add, 0 to change, 0 to destroy.
Changes to Outputs:
 + lambda_event_source_mapping_function_arn = {
 + dynamodb = (known after apply)
 + kinesis = (known after apply)
 + mq = (known after apply)
 + sqs = (known after apply)
 }
 + lambda_event_source_mapping_state = {
 + dynamodb = (known after apply)
 + kinesis = (known after apply)
 + mq = (known after apply)
 + sqs = (known after apply)
 }
 + lambda_event_source_mapping_state_transition_reason = {
 + dynamodb = (known after apply)
 + kinesis = (known after apply)
 + mq = (known after apply)
 + sqs = (known after apply)
 }
 + lambda_event_source_mapping_uuid = {
 + dynamodb = (known after apply)
 + kinesis = (known after apply)
 + mq = (known after apply)
 + sqs = (known after apply)
 }
 + lambda_function_arn = (known after apply)
 + lambda_function_invoke_arn = (known after apply)
 + lambda_function_last_modified = (known after apply)
 + lambda_function_name = (known after apply)
 + lambda_function_qualified_arn = (known after apply)
 + lambda_function_source_code_hash = "YZ7bP6ofV1EOv34MCe0wMZbZEaJffERwzSGjA6FAzZc="
 + lambda_function_source_code_size = (known after apply)
 + lambda_function_version = (known after apply)
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Saved the plan to: .plan
To perform exactly these actions, run the following command to apply:
 terraform apply ".plan"
2. terraform apply
> terraform apply .plan
random_pet.this: Creating...
random_password.this: Creating...
random_pet.this: Creation complete after 0s [id=mint-eel]
module.lambda_function.local_file.archive_plan[0]: Creating...
random_password.this: Creation complete after 0s [id=none]
module.lambda_function.local_file.archive_plan[0]: Creation complete after 0s [id=9b008b32700599bb551ceb069bac6a539544a470]
module.lambda_function.null_resource.archive[0]: Creating...
module.lambda_function.null_resource.archive[0]: Provisioning with 'local-exec'...
module.lambda_function.null_resource.archive[0] (local-exec): Executing: ["python3" "../../package.py" "build" "--timestamp" "1629384553954721000" "builds/09df5667aa77260cb0bac734adccae8d859ac1b014db638db32448b8068cae7c.plan.json"]
module.lambda_function.null_resource.archive[0] (local-exec): Reused: builds/09df5667aa77260cb0bac734adccae8d859ac1b014db638db32448b8068cae7c.zip
module.lambda_function.null_resource.archive[0]: Creation complete after 0s [id=658689748854609266]
module.lambda_function.aws_cloudwatch_log_group.lambda[0]: Creating...
aws_secretsmanager_secret.this: Creating...
aws_kinesis_stream.this: Creating...
aws_sqs_queue.failure: Creating...
module.lambda_function.aws_iam_policy.vpc[0]: Creating...
module.lambda_function.aws_iam_role.lambda[0]: Creating...
aws_mq_broker.this: Creating...
aws_sqs_queue.this: Creating...
aws_dynamodb_table.this: Creating...
module.lambda_function.aws_cloudwatch_log_group.lambda[0]: Creation complete after 1s [id=/aws/lambda/mint-eel-lambda-event-source-mapping]
module.lambda_function.data.aws_iam_policy_document.logs[0]: Reading...
module.lambda_function.data.aws_iam_policy_document.logs[0]: Read complete after 0s [id=3858917615]
module.lambda_function.aws_iam_policy.logs[0]: Creating...
aws_secretsmanager_secret.this: Creation complete after 1s [id=arn:aws:secretsmanager:eu-central-1:xxxxxxxxxxxx:secret:mint-eel-mq-credentials-YuPaJG]
aws_secretsmanager_secret_version.this: Creating...
aws_sqs_queue.this: Creation complete after 1s [id=https://sqs.eu-central-1.amazonaws.com/xxxxxxxxxxxx/mint-eel]
aws_secretsmanager_secret_version.this: Creation complete after 0s [id=arn:aws:secretsmanager:eu-central-1:xxxxxxxxxxxx:secret:mint-eel-mq-credentials-YuPaJG|2D4F2099-3A06-43AC-9AFF-160D2B95C141]
aws_sqs_queue.failure: Creation complete after 1s [id=https://sqs.eu-central-1.amazonaws.com/xxxxxxxxxxxx/mint-eel-failure]
module.lambda_function.aws_iam_policy.vpc[0]: Creation complete after 2s [id=arn:aws:iam::xxxxxxxxxxxx:policy/mint-eel-lambda-event-source-mapping-vpc]
module.lambda_function.aws_iam_role.lambda[0]: Creation complete after 3s [id=mint-eel-lambda-event-source-mapping]
module.lambda_function.aws_iam_role_policy_attachment.additional_many[2]: Creating...
module.lambda_function.aws_iam_role_policy_attachment.additional_many[1]: Creating...
module.lambda_function.aws_iam_role_policy_attachment.additional_many[0]: Creating...
module.lambda_function.aws_iam_policy_attachment.vpc[0]: Creating...
module.lambda_function.aws_iam_policy.logs[0]: Creation complete after 2s [id=arn:aws:iam::xxxxxxxxxxxx:policy/mint-eel-lambda-event-source-mapping-logs]
module.lambda_function.aws_lambda_function.this[0]: Creating...
module.lambda_function.aws_iam_policy_attachment.logs[0]: Creating...
module.lambda_function.aws_iam_role_policy_attachment.additional_many[2]: Creation complete after 1s [id=mint-eel-lambda-event-source-mapping-20210819150038381300000002]
module.lambda_function.aws_iam_role_policy_attachment.additional_many[1]: Creation complete after 1s [id=mint-eel-lambda-event-source-mapping-20210819150038431300000003]
module.lambda_function.aws_iam_role_policy_attachment.additional_many[0]: Creation complete after 1s [id=mint-eel-lambda-event-source-mapping-20210819150038505100000004]
module.lambda_function.aws_iam_policy_attachment.logs[0]: Creation complete after 2s [id=mint-eel-lambda-event-source-mapping-logs]
module.lambda_function.aws_iam_policy_attachment.vpc[0]: Creation complete after 2s [id=mint-eel-lambda-event-source-mapping-vpc]
aws_dynamodb_table.this: Creation complete after 8s [id=mint-eel]
aws_kinesis_stream.this: Still creating... [10s elapsed]
aws_mq_broker.this: Still creating... [10s elapsed]
module.lambda_function.aws_lambda_function.this[0]: Still creating... [10s elapsed]
aws_mq_broker.this: Still creating... [20s elapsed]
aws_kinesis_stream.this: Still creating... [20s elapsed]
module.lambda_function.aws_lambda_function.this[0]: Still creating... [20s elapsed]
module.lambda_function.aws_lambda_function.this[0]: Creation complete after 23s [id=mint-eel-lambda-event-source-mapping]
aws_mq_broker.this: Still creating... [30s elapsed]
aws_kinesis_stream.this: Still creating... [30s elapsed]
aws_kinesis_stream.this: Creation complete after 32s [id=arn:aws:kinesis:eu-central-1:xxxxxxxxxxxx:stream/mint-eel]
aws_mq_broker.this: Still creating... [40s elapsed]
aws_mq_broker.this: Still creating... [50s elapsed]
aws_mq_broker.this: Still creating... [1m0s elapsed]
aws_mq_broker.this: Still creating... [1m10s elapsed]
aws_mq_broker.this: Still creating... [1m20s elapsed]
aws_mq_broker.this: Still creating... [1m30s elapsed]
aws_mq_broker.this: Still creating... [1m40s elapsed]
aws_mq_broker.this: Still creating... [1m50s elapsed]
aws_mq_broker.this: Still creating... [2m0s elapsed]
aws_mq_broker.this: Still creating... [2m10s elapsed]
aws_mq_broker.this: Still creating... [2m20s elapsed]
aws_mq_broker.this: Still creating... [2m30s elapsed]
aws_mq_broker.this: Still creating... [2m40s elapsed]
aws_mq_broker.this: Still creating... [2m50s elapsed]
aws_mq_broker.this: Still creating... [3m0s elapsed]
aws_mq_broker.this: Still creating... [3m10s elapsed]
aws_mq_broker.this: Still creating... [3m20s elapsed]
aws_mq_broker.this: Still creating... [3m30s elapsed]
aws_mq_broker.this: Still creating... [3m40s elapsed]
aws_mq_broker.this: Still creating... [3m50s elapsed]
aws_mq_broker.this: Still creating... [4m0s elapsed]
aws_mq_broker.this: Still creating... [4m10s elapsed]
aws_mq_broker.this: Still creating... [4m20s elapsed]
aws_mq_broker.this: Still creating... [4m30s elapsed]
aws_mq_broker.this: Still creating... [4m40s elapsed]
aws_mq_broker.this: Still creating... [4m50s elapsed]
aws_mq_broker.this: Still creating... [5m0s elapsed]
aws_mq_broker.this: Still creating... [5m10s elapsed]
aws_mq_broker.this: Still creating... [5m20s elapsed]
aws_mq_broker.this: Still creating... [5m30s elapsed]
aws_mq_broker.this: Still creating... [5m40s elapsed]
aws_mq_broker.this: Still creating... [5m50s elapsed]
aws_mq_broker.this: Still creating... [6m0s elapsed]
aws_mq_broker.this: Still creating... [6m10s elapsed]
aws_mq_broker.this: Still creating... [6m20s elapsed]
aws_mq_broker.this: Still creating... [6m30s elapsed]
aws_mq_broker.this: Still creating... [6m40s elapsed]
aws_mq_broker.this: Still creating... [6m50s elapsed]
aws_mq_broker.this: Still creating... [7m0s elapsed]
aws_mq_broker.this: Still creating... [7m10s elapsed]
aws_mq_broker.this: Still creating... [7m20s elapsed]
aws_mq_broker.this: Still creating... [7m30s elapsed]
aws_mq_broker.this: Still creating... [7m40s elapsed]
aws_mq_broker.this: Still creating... [7m50s elapsed]
aws_mq_broker.this: Still creating... [8m0s elapsed]
aws_mq_broker.this: Still creating... [8m10s elapsed]
aws_mq_broker.this: Still creating... [8m20s elapsed]
aws_mq_broker.this: Still creating... [8m30s elapsed]
aws_mq_broker.this: Still creating... [8m40s elapsed]
aws_mq_broker.this: Still creating... [8m50s elapsed]
aws_mq_broker.this: Still creating... [9m0s elapsed]
aws_mq_broker.this: Still creating... [9m10s elapsed]
aws_mq_broker.this: Still creating... [9m20s elapsed]
aws_mq_broker.this: Still creating... [9m30s elapsed]
aws_mq_broker.this: Still creating... [9m40s elapsed]
aws_mq_broker.this: Still creating... [9m50s elapsed]
aws_mq_broker.this: Still creating... [10m0s elapsed]
aws_mq_broker.this: Still creating... [10m10s elapsed]
aws_mq_broker.this: Creation complete after 10m18s [id=b-f4c26388-622a-4859-b8e3-c71488f8296e]
module.lambda_function.data.aws_iam_policy_document.additional_inline[0]: Reading...
module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["kinesis"]: Creating...
module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["mq"]: Creating...
module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["sqs"]: Creating...
module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["dynamodb"]: Creating...
module.lambda_function.aws_lambda_event_source_mapping.this["kinesis"]: Creating...
module.lambda_function.data.aws_iam_policy_document.additional_inline[0]: Read complete after 0s [id=727697574]
module.lambda_function.aws_lambda_event_source_mapping.this["dynamodb"]: Creating...
module.lambda_function.aws_lambda_event_source_mapping.this["sqs"]: Creating...
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Creating...
module.lambda_function.aws_iam_policy.additional_inline[0]: Creating...
module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["kinesis"]: Creation complete after 0s [id=kinesis]
module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["mq"]: Creation complete after 1s [id=mq]
module.lambda_function.aws_lambda_event_source_mapping.this["kinesis"]: Creation complete after 1s [id=4ededcf1-4807-4c76-a708-23061fecbd2f]
module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["sqs"]: Creation complete after 1s [id=sqs]
module.lambda_function.aws_lambda_permission.unqualified_alias_triggers["dynamodb"]: Creation complete after 1s [id=dynamodb]
module.lambda_function.aws_iam_policy.additional_inline[0]: Creation complete after 2s [id=arn:aws:iam::xxxxxxxxxxxx:policy/mint-eel-lambda-event-source-mapping-inline]
module.lambda_function.aws_iam_policy_attachment.additional_inline[0]: Creating...
module.lambda_function.aws_iam_policy_attachment.additional_inline[0]: Creation complete after 1s [id=mint-eel-lambda-event-source-mapping]
module.lambda_function.aws_lambda_event_source_mapping.this["dynamodb"]: Still creating... [10s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["sqs"]: Still creating... [10s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [10s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["sqs"]: Creation complete after 15s [id=e1d38fbe-57f9-49fd-8225-439d246875d7]
module.lambda_function.aws_lambda_event_source_mapping.this["dynamodb"]: Creation complete after 18s [id=b9041135-b2ae-4aa7-bb4b-d7610dfc482d]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [20s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [30s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [40s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [50s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [1m0s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [1m10s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [1m20s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [1m30s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [1m40s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [1m50s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [2m0s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [2m10s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [2m20s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [2m30s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [2m40s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Still creating... [2m50s elapsed]
module.lambda_function.aws_lambda_event_source_mapping.this["mq"]: Creation complete after 2m51s [id=446b55ed-be2f-4e60-91b7-af721b4ae2ac]
Releasing state lock. This may take a few moments...
Apply complete! Resources: 31 added, 0 changed, 0 destroyed.
Outputs:
lambda_event_source_mapping_function_arn = {
 "dynamodb" = "arn:aws:lambda:eu-central-1:xxxxxxxxxxxx:function:mint-eel-lambda-event-source-mapping"
 "kinesis" = "arn:aws:lambda:eu-central-1:xxxxxxxxxxxx:function:mint-eel-lambda-event-source-mapping"
 "mq" = "arn:aws:lambda:eu-central-1:xxxxxxxxxxxx:function:mint-eel-lambda-event-source-mapping"
 "sqs" = "arn:aws:lambda:eu-central-1:xxxxxxxxxxxx:function:mint-eel-lambda-event-source-mapping"
}
lambda_event_source_mapping_state = {
 "dynamodb" = "Enabled"
 "kinesis" = "Enabled"
 "mq" = "Enabled"
 "sqs" = "Enabled"
}
lambda_event_source_mapping_state_transition_reason = {
 "dynamodb" = "User action"
 "kinesis" = "User action"
 "mq" = "USER_INITIATED"
 "sqs" = "USER_INITIATED"
}
lambda_event_source_mapping_uuid = {
 "dynamodb" = "b9041135-b2ae-4aa7-bb4b-d7610dfc482d"
 "kinesis" = "4ededcf1-4807-4c76-a708-23061fecbd2f"
 "mq" = "446b55ed-be2f-4e60-91b7-af721b4ae2ac"
 "sqs" = "e1d38fbe-57f9-49fd-8225-439d246875d7"
}
lambda_function_arn = "arn:aws:lambda:eu-central-1:xxxxxxxxxxxx:function:mint-eel-lambda-event-source-mapping"
lambda_function_invoke_arn = "arn:aws:apigateway:eu-central-1:lambda:path/2015-03-31/functions/arn:aws:lambda:eu-central-1:xxxxxxxxxxxx:function:mint-eel-lambda-event-source-mapping/invocations"
lambda_function_last_modified = "2021年08月19日T15:00:55.603+0000"
lambda_function_name = "mint-eel-lambda-event-source-mapping"
lambda_function_qualified_arn = "arn:aws:lambda:eu-central-1:xxxxxxxxxxxx:function:mint-eel-lambda-event-source-mapping:$LATEST"
lambda_function_source_code_hash = "YZ7bP6ofV1EOv34MCe0wMZbZEaJffERwzSGjA6FAzZc="
lambda_function_source_code_size = 204220
lambda_function_version = "$LATEST"

Additionally, I deleted the call to tomap() function in aws_lambda_event_source_mapping resource, without this change plan operation was failing with the following error:

Inappropriate value for attribute "queues": set of string required.

Please let me know if it is ok with you.

@Infra-Red Infra-Red force-pushed the source_access_configuration branch from 0367605 to 6426d1a Compare August 20, 2021 12:23
Allow to configure queues in aws_lambda_event_source_mapping to support
Amazon MQ event source type.
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-function-mq.html
Signed-off-by: Andrei Krasnitski <a.krasnitski@outlook.com>
Allow to configure source_access_configuration in aws_lambda_event_source_mapping
to support Amazon MQ event source type.
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-property-function-mq.html
Signed-off-by: Andrei Krasnitski <a.krasnitski@outlook.com>
`queues` and `source_access_configuration` arguments support for
resource/aws_lambda_event_source_mapping has been introduced
in 3.43.0.
https://github.com/hashicorp/terraform-provider-aws/blob/main/CHANGELOG.md#3430-june-01-2021
Signed-off-by: Andrei Krasnitski <a.krasnitski@outlook.com>
Signed-off-by: Andrei Krasnitski <a.krasnitski@outlook.com>
Signed-off-by: Andrei Krasnitski <a.krasnitski@outlook.com>
@Infra-Red Infra-Red force-pushed the source_access_configuration branch from 6426d1a to 385db13 Compare August 22, 2021 11:23
Copy link
Contributor Author

Hi @antonbabenko, please review when you get a chance. Thanks!

resource "aws_mq_broker" "this" {
broker_name = random_pet.this.id
engine_type = "RabbitMQ"
engine_version = "3.8.17"
Copy link
Member

@antonbabenko antonbabenko Aug 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: BadRequestException: Broker engine version [3.8.17] is invalid for broker engine type [RABBITMQ]. Valid values: [3.8.11, 3.8.6].

I update the code to use 3.8.11

@antonbabenko antonbabenko merged commit 43a5134 into terraform-aws-modules:master Aug 30, 2021
Copy link
Member

Thanks @Infra-Red !

v2.12.0 has been just released.

Infra-Red reacted with thumbs up emoji

@Infra-Red Infra-Red deleted the source_access_configuration branch August 30, 2021 10:02
Copy link

github-actions bot commented Nov 9, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@antonbabenko antonbabenko antonbabenko requested changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /