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

fix: 5809 batch alarm rule names #374

Merged
merged 9 commits into from
Oct 9, 2024
Merged

fix: 5809 batch alarm rule names #374

merged 9 commits into from
Oct 9, 2024

Conversation

Wi11Shell
Copy link
Contributor

Description

Related issue: https://dvsa.atlassian.net/browse/VOL-5809

Before submitting (or marking as "ready for review")

  • Does the pull request title follow the conventional commit specification?
  • Have you performed a self-review of the code
  • Have you have added tests that prove the fix or feature is effective and working
  • Did you make sure to update any documentation relating to this change?

@Wi11Shell Wi11Shell requested a review from a team as a code owner October 8, 2024 13:49
Copy link
Contributor

github-actions bot commented Oct 9, 2024

Terraform plan for environment: int

Commit: 94d2001

API version: 0a57d72
CLI version: 0a57d72
Selfserve version: 0a57d72
Internal version: 0a57d72

Plan summary

3 to add, 0 to change, 5 to destroy

🆕 Creates

module.service.module.eventbridge_sns.aws_cloudwatch_event_rule.this["vol-app-int-batch-failure-event"]
module.service.module.sns_batch_failure.aws_sns_topic.this[0]
module.service.module.sns_batch_failure.aws_sns_topic_policy.this[0]

🗑️ Deletes

module.service.module.eventbridge_sns.aws_cloudwatch_event_rule.this["batch-fail-sns"]
module.service.module.eventbridge_sns.aws_cloudwatch_event_target.this["batch-fail-event"]
module.service.module.eventbridge_sns.aws_iam_role.eventbridge[0]
module.service.module.sns_batch_fail.aws_sns_topic.this[0]
module.service.module.sns_batch_fail.aws_sns_topic_policy.this[0]

📖 Reads

module.service.module.sns_batch_failure.data.aws_iam_policy_document.this[0]

Show full plan
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  - destroy
-/+ destroy and then create replacement
 <= read (data resources)

Terraform will perform the following actions:

  # module.service.module.eventbridge_sns.aws_cloudwatch_event_rule.this["batch-fail-sns"] will be destroyed
  # (because key ["batch-fail-sns"] is not in for_each map)
  - resource "aws_cloudwatch_event_rule" "this" {
      - arn                 = "arn:aws:events:eu-west-1:054614622558:rule/batch-fail-sns-rule" -> null
      - description         = "Capture failed Batch Events sent to SNS" -> null
      - event_bus_name      = "default" -> null
      - event_pattern       = jsonencode(
            {
              - detail      = {
                  - jobName = [
                      - {
                          - wildcard = "vol-app-int-*"
                        },
                    ]
                  - status  = [
                      - "FAILED",
                    ]
                }
              - detail-type = [
                  - "Batch Job State Change",
                ]
              - source      = [
                  - "aws.batch",
                ]
            }
        ) -> null
      - force_destroy       = false -> null
      - id                  = "batch-fail-sns-rule" -> null
      - is_enabled          = true -> null
      - name                = "batch-fail-sns-rule" -> null
      - state               = "ENABLED" -> null
      - tags                = {
          - "Component"   = "DEVCI"
          - "Environment" = "DEV/APP/CI"
          - "Module"      = "BATCHTESTINFRA"
          - "Name"        = "batch-fail-sns-rule"
          - "Role"        = "BATCHTESTINFRA"
        } -> null
      - tags_all            = {
          - "Component"   = "DEVCI"
          - "Environment" = "DEV/APP/CI"
          - "Module"      = "BATCHTESTINFRA"
          - "Name"        = "batch-fail-sns-rule"
          - "Role"        = "BATCHTESTINFRA"
        } -> null
        # (3 unchanged attributes hidden)
    }

  # module.service.module.eventbridge_sns.aws_cloudwatch_event_rule.this["vol-app-int-batch-failure-event"] will be created
  + resource "aws_cloudwatch_event_rule" "this" {
      + arn            = (known after apply)
      + description    = "Capture failed Batch Events sent to SNS"
      + event_bus_name = "default"
      + event_pattern  = jsonencode(
            {
              + detail      = {
                  + jobName = [
                      + {
                          + wildcard = "vol-app-int-*"
                        },
                    ]
                  + status  = [
                      + "FAILED",
                    ]
                }
              + detail-type = [
                  + "Batch Job State Change",
                ]
              + source      = [
                  + "aws.batch",
                ]
            }
        )
      + force_destroy  = false
      + id             = (known after apply)
      + name           = "vol-app-int-batch-failure-event-rule"
      + name_prefix    = (known after apply)
      + state          = "ENABLED"
      + tags           = {
          + "Name" = "vol-app-int-batch-failure-event-rule"
        }
      + tags_all       = {
          + "Environment" = "int"
          + "Name"        = "vol-app-int-batch-failure-event-rule"
          + "Repository"  = "https://github.com/dvsa/vol-app"
        }
    }

  # module.service.module.eventbridge_sns.aws_cloudwatch_event_target.this["batch-fail-event"] must be replaced
-/+ resource "aws_cloudwatch_event_target" "this" {
      ~ arn            = "arn:aws:sns:eu-west-1:054614622558:vol-app-int-batch-fail-topic-20241008100924470600000002" -> (known after apply)
      ~ id             = "batch-fail-sns-rule-terraform-20241008100927898000000003" -> (known after apply)
      ~ rule           = "batch-fail-sns-rule" -> "vol-app-int-batch-failure-event-rule" # forces replacement
      ~ target_id      = "terraform-20241008100927898000000003" -> (known after apply)
        # (5 unchanged attributes hidden)
    }

  # module.service.module.eventbridge_sns.aws_iam_role.eventbridge[0] must be replaced
-/+ resource "aws_iam_role" "eventbridge" {
      ~ arn                   = "arn:aws:iam::054614622558:role/vol-app-int-batch-fail-role" -> (known after apply)
      ~ create_date           = "2024-10-08T10:09:24Z" -> (known after apply)
      ~ id                    = "vol-app-int-batch-fail-role" -> (known after apply)
      ~ managed_policy_arns   = [] -> (known after apply)
      ~ name                  = "vol-app-int-batch-fail-role" -> "default" # forces replacement
      + name_prefix           = (known after apply)
      ~ tags                  = {
          ~ "Name" = "vol-app-int-batch-fail-role" -> "default"
        }
      ~ tags_all              = {
          ~ "Name"        = "vol-app-int-batch-fail-role" -> "default"
            # (2 unchanged elements hidden)
        }
      ~ unique_id             = "AROAQZN2JAFPEXQ3MABZL" -> (known after apply)
        # (6 unchanged attributes hidden)

      ~ inline_policy (known after apply)
    }

  # module.service.module.sns_batch_fail.aws_sns_topic.this[0] will be destroyed
  # (because aws_sns_topic.this is not in configuration)
  - resource "aws_sns_topic" "this" {
      - application_success_feedback_sample_rate = 0 -> null
      - arn                                      = "arn:aws:sns:eu-west-1:054614622558:vol-app-int-batch-fail-topic-20241008100924470600000002" -> null
      - content_based_deduplication              = false -> null
      - display_name                             = "batch-event-failed" -> null
      - fifo_topic                               = false -> null
      - firehose_success_feedback_sample_rate    = 0 -> null
      - http_success_feedback_sample_rate        = 0 -> null
      - id                                       = "arn:aws:sns:eu-west-1:054614622558:vol-app-int-batch-fail-topic-20241008100924470600000002" -> null
      - lambda_success_feedback_sample_rate      = 0 -> null
      - name                                     = "vol-app-int-batch-fail-topic-20241008100924470600000002" -> null
      - name_prefix                              = "vol-app-int-batch-fail-topic-" -> null
      - owner                                    = "054614622558" -> null
      - policy                                   = jsonencode(
            {
              - Id        = "__default_policy_ID"
              - Statement = [
                  - {
                      - Action    = [
                          - "SNS:GetTopicAttributes",
                          - "SNS:SetTopicAttributes",
                          - "SNS:AddPermission",
                          - "SNS:RemovePermission",
                          - "SNS:DeleteTopic",
                          - "SNS:Subscribe",
                          - "SNS:ListSubscriptionsByTopic",
                          - "SNS:Publish",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "AWS:SourceOwner" = "054614622558"
                            }
                        }
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "*"
                        }
                      - Resource  = "arn:aws:sns:eu-west-1:054614622558:vol-app-int-batch-fail-topic-20241008100924470600000002"
                      - Sid       = "__default_statement_ID"
                    },
                ]
              - Version   = "2008-10-17"
            }
        ) -> null
      - signature_version                        = 0 -> null
      - sqs_success_feedback_sample_rate         = 0 -> null
      - tags                                     = {
          - "Name" = "vol-app-int-aws-sns-batch-fail"
        } -> null
      - tags_all                                 = {
          - "Environment" = "int"
          - "Name"        = "vol-app-int-aws-sns-batch-fail"
          - "Repository"  = "https://github.com/dvsa/vol-app"
        } -> null
        # (15 unchanged attributes hidden)
    }

  # module.service.module.sns_batch_fail.aws_sns_topic_policy.this[0] will be destroyed
  # (because aws_sns_topic_policy.this is not in configuration)
  - resource "aws_sns_topic_policy" "this" {
      - arn    = "arn:aws:sns:eu-west-1:054614622558:vol-app-int-batch-fail-topic-20241008100924470600000002" -> null
      - id     = "arn:aws:sns:eu-west-1:054614622558:vol-app-int-batch-fail-topic-20241008100924470600000002" -> null
      - owner  = "054614622558" -> null
      - policy = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = [
                          - "sns:Subscribe",
                          - "sns:SetTopicAttributes",
                          - "sns:RemovePermission",
                          - "sns:Publish",
                          - "sns:ListSubscriptionsByTopic",
                          - "sns:GetTopicAttributes",
                          - "sns:DeleteTopic",
                          - "sns:AddPermission",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "AWS:SourceOwner" = "054614622558"
                            }
                        }
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "*"
                        }
                      - Resource  = "arn:aws:sns:eu-west-1:054614622558:vol-app-int-batch-fail-topic-20241008100924470600000002"
                      - Sid       = "__default_statement_ID"
                    },
                  - {
                      - Action    = "sns:Publish"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::054614622558:root"
                        }
                      - Resource  = "arn:aws:sns:eu-west-1:054614622558:vol-app-int-batch-fail-topic-20241008100924470600000002"
                      - Sid       = "pub"
                    },
                  - {
                      - Action    = [
                          - "sns:Subscribe",
                          - "sns:Receive",
                        ]
                      - Condition = {
                          - ArnLike = {
                              - "aws:SourceArn" = ""
                            }
                        }
                      - Effect    = "Allow"
                      - Principal = {
                          - Service = "events.amazonaws.com"
                        }
                      - Resource  = "arn:aws:sns:eu-west-1:054614622558:vol-app-int-batch-fail-topic-20241008100924470600000002"
                      - Sid       = "sub"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
    }

  # module.service.module.sns_batch_failure.data.aws_iam_policy_document.this[0] will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "this" {
      + id                        = (known after apply)
      + json                      = (known after apply)
      + minified_json             = (known after apply)
      + override_policy_documents = []
      + source_policy_documents   = []

      + statement {
          + actions   = [
              + "sns:AddPermission",
              + "sns:DeleteTopic",
              + "sns:GetTopicAttributes",
              + "sns:ListSubscriptionsByTopic",
              + "sns:Publish",
              + "sns:RemovePermission",
              + "sns:SetTopicAttributes",
              + "sns:Subscribe",
            ]
          + effect    = "Allow"
          + resources = [
              + (known after apply),
            ]
          + sid       = "__default_statement_ID"

          + condition {
              + test     = "StringEquals"
              + values   = [
                  + "054614622558",
                ]
              + variable = "AWS:SourceOwner"
            }

          + principals {
              + identifiers = [
                  + "*",
                ]
              + type        = "AWS"
            }
        }
      + statement {
          + actions   = [
              + "sns:Publish",
            ]
          + resources = (known after apply)
          + sid       = "pub"

          + principals {
              + identifiers = [
                  + "arn:aws:iam::054614622558:root",
                ]
              + type        = "AWS"
            }
        }
      + statement {
          + actions   = [
              + "sns:Receive",
              + "sns:Subscribe",
            ]
          + resources = (known after apply)
          + sid       = "sub"

          + condition {
              + test     = "ArnLike"
              + values   = [
                  + null,
                ]
              + variable = "aws:SourceArn"
            }

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

  # module.service.module.sns_batch_failure.aws_sns_topic.this[0] will be created
  + resource "aws_sns_topic" "this" {
      + arn                         = (known after apply)
      + beginning_archive_time      = (known after apply)
      + content_based_deduplication = false
      + display_name                = "vol-app-int-batch-event-failed"
      + fifo_topic                  = false
      + id                          = (known after apply)
      + name                        = (known after apply)
      + name_prefix                 = "vol-app-int-batch-failure-topic-"
      + owner                       = (known after apply)
      + policy                      = (known after apply)
      + signature_version           = (known after apply)
      + tags                        = {
          + "Name" = "vol-app-int-aws-sns-batch-failure"
        }
      + tags_all                    = {
          + "Environment" = "int"
          + "Name"        = "vol-app-int-aws-sns-batch-failure"
          + "Repository"  = "https://github.com/dvsa/vol-app"
        }
      + tracing_config              = (known after apply)
    }

  # module.service.module.sns_batch_failure.aws_sns_topic_policy.this[0] will be created
  + resource "aws_sns_topic_policy" "this" {
      + arn    = (known after apply)
      + id     = (known after apply)
      + owner  = (known after apply)
      + policy = (known after apply)
    }

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

Copy link
Contributor

github-actions bot commented Oct 9, 2024

Terraform plan for environment: dev

Commit: 94d2001

API version: 0a57d72
CLI version: 0a57d72
Selfserve version: 0a57d72
Internal version: 0a57d72

Plan summary

3 to add, 0 to change, 5 to destroy

🆕 Creates

module.service.module.eventbridge_sns.aws_cloudwatch_event_rule.this["vol-app-dev-batch-failure-event"]
module.service.module.sns_batch_failure.aws_sns_topic.this[0]
module.service.module.sns_batch_failure.aws_sns_topic_policy.this[0]

🗑️ Deletes

module.service.module.eventbridge_sns.aws_cloudwatch_event_rule.this["batch-fail-sns"]
module.service.module.eventbridge_sns.aws_cloudwatch_event_target.this["batch-fail-event"]
module.service.module.eventbridge_sns.aws_iam_role.eventbridge[0]
module.service.module.sns_batch_fail.aws_sns_topic.this[0]
module.service.module.sns_batch_fail.aws_sns_topic_policy.this[0]

📖 Reads

module.service.module.sns_batch_failure.data.aws_iam_policy_document.this[0]

Show full plan
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create
  - destroy
-/+ destroy and then create replacement
 <= read (data resources)

Terraform will perform the following actions:

  # module.service.module.eventbridge_sns.aws_cloudwatch_event_rule.this["batch-fail-sns"] will be destroyed
  # (because key ["batch-fail-sns"] is not in for_each map)
  - resource "aws_cloudwatch_event_rule" "this" {
      - arn                 = "arn:aws:events:eu-west-1:054614622558:rule/batch-fail-sns-rule" -> null
      - description         = "Capture failed Batch Events sent to SNS" -> null
      - event_bus_name      = "default" -> null
      - event_pattern       = jsonencode(
            {
              - detail      = {
                  - jobName = [
                      - {
                          - wildcard = "vol-app-dev-*"
                        },
                    ]
                  - status  = [
                      - "FAILED",
                    ]
                }
              - detail-type = [
                  - "Batch Job State Change",
                ]
              - source      = [
                  - "aws.batch",
                ]
            }
        ) -> null
      - force_destroy       = false -> null
      - id                  = "batch-fail-sns-rule" -> null
      - is_enabled          = true -> null
      - name                = "batch-fail-sns-rule" -> null
      - state               = "ENABLED" -> null
      - tags                = {
          - "Component"   = "DEVCI"
          - "Environment" = "DEV/APP/CI"
          - "Module"      = "BATCHTESTINFRA"
          - "Name"        = "batch-fail-sns-rule"
          - "Role"        = "BATCHTESTINFRA"
        } -> null
      - tags_all            = {
          - "Component"   = "DEVCI"
          - "Environment" = "DEV/APP/CI"
          - "Module"      = "BATCHTESTINFRA"
          - "Name"        = "batch-fail-sns-rule"
          - "Role"        = "BATCHTESTINFRA"
        } -> null
        # (3 unchanged attributes hidden)
    }

  # module.service.module.eventbridge_sns.aws_cloudwatch_event_rule.this["vol-app-dev-batch-failure-event"] will be created
  + resource "aws_cloudwatch_event_rule" "this" {
      + arn            = (known after apply)
      + description    = "Capture failed Batch Events sent to SNS"
      + event_bus_name = "default"
      + event_pattern  = jsonencode(
            {
              + detail      = {
                  + jobName = [
                      + {
                          + wildcard = "vol-app-dev-*"
                        },
                    ]
                  + status  = [
                      + "FAILED",
                    ]
                }
              + detail-type = [
                  + "Batch Job State Change",
                ]
              + source      = [
                  + "aws.batch",
                ]
            }
        )
      + force_destroy  = false
      + id             = (known after apply)
      + name           = "vol-app-dev-batch-failure-event-rule"
      + name_prefix    = (known after apply)
      + state          = "ENABLED"
      + tags           = {
          + "Name" = "vol-app-dev-batch-failure-event-rule"
        }
      + tags_all       = {
          + "Environment" = "dev"
          + "Name"        = "vol-app-dev-batch-failure-event-rule"
          + "Repository"  = "https://github.com/dvsa/vol-app"
        }
    }

  # module.service.module.eventbridge_sns.aws_cloudwatch_event_target.this["batch-fail-event"] must be replaced
-/+ resource "aws_cloudwatch_event_target" "this" {
      ~ arn            = "arn:aws:sns:eu-west-1:054614622558:vol-app-dev-batch-fail-topic-20241008100828830800000002" -> (known after apply)
      ~ id             = "batch-fail-sns-rule-terraform-20241008100831894300000003" -> (known after apply)
      ~ rule           = "batch-fail-sns-rule" -> "vol-app-dev-batch-failure-event-rule" # forces replacement
      ~ target_id      = "terraform-20241008100831894300000003" -> (known after apply)
        # (5 unchanged attributes hidden)
    }

  # module.service.module.eventbridge_sns.aws_iam_role.eventbridge[0] must be replaced
-/+ resource "aws_iam_role" "eventbridge" {
      ~ arn                   = "arn:aws:iam::054614622558:role/vol-app-dev-batch-fail-role" -> (known after apply)
      ~ create_date           = "2024-10-08T10:08:29Z" -> (known after apply)
      ~ id                    = "vol-app-dev-batch-fail-role" -> (known after apply)
      ~ managed_policy_arns   = [] -> (known after apply)
      ~ name                  = "vol-app-dev-batch-fail-role" -> "default" # forces replacement
      + name_prefix           = (known after apply)
      ~ tags                  = {
          ~ "Name" = "vol-app-dev-batch-fail-role" -> "default"
        }
      ~ tags_all              = {
          ~ "Name"        = "vol-app-dev-batch-fail-role" -> "default"
            # (2 unchanged elements hidden)
        }
      ~ unique_id             = "AROAQZN2JAFPP5SI77HPG" -> (known after apply)
        # (6 unchanged attributes hidden)

      ~ inline_policy (known after apply)
    }

  # module.service.module.sns_batch_fail.aws_sns_topic.this[0] will be destroyed
  # (because aws_sns_topic.this is not in configuration)
  - resource "aws_sns_topic" "this" {
      - application_success_feedback_sample_rate = 0 -> null
      - arn                                      = "arn:aws:sns:eu-west-1:054614622558:vol-app-dev-batch-fail-topic-20241008100828830800000002" -> null
      - content_based_deduplication              = false -> null
      - display_name                             = "batch-event-failed" -> null
      - fifo_topic                               = false -> null
      - firehose_success_feedback_sample_rate    = 0 -> null
      - http_success_feedback_sample_rate        = 0 -> null
      - id                                       = "arn:aws:sns:eu-west-1:054614622558:vol-app-dev-batch-fail-topic-20241008100828830800000002" -> null
      - lambda_success_feedback_sample_rate      = 0 -> null
      - name                                     = "vol-app-dev-batch-fail-topic-20241008100828830800000002" -> null
      - name_prefix                              = "vol-app-dev-batch-fail-topic-" -> null
      - owner                                    = "054614622558" -> null
      - policy                                   = jsonencode(
            {
              - Id        = "__default_policy_ID"
              - Statement = [
                  - {
                      - Action    = [
                          - "SNS:GetTopicAttributes",
                          - "SNS:SetTopicAttributes",
                          - "SNS:AddPermission",
                          - "SNS:RemovePermission",
                          - "SNS:DeleteTopic",
                          - "SNS:Subscribe",
                          - "SNS:ListSubscriptionsByTopic",
                          - "SNS:Publish",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "AWS:SourceOwner" = "054614622558"
                            }
                        }
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "*"
                        }
                      - Resource  = "arn:aws:sns:eu-west-1:054614622558:vol-app-dev-batch-fail-topic-20241008100828830800000002"
                      - Sid       = "__default_statement_ID"
                    },
                ]
              - Version   = "2008-10-17"
            }
        ) -> null
      - signature_version                        = 0 -> null
      - sqs_success_feedback_sample_rate         = 0 -> null
      - tags                                     = {
          - "Name" = "vol-app-dev-aws-sns-batch-fail"
        } -> null
      - tags_all                                 = {
          - "Environment" = "dev"
          - "Name"        = "vol-app-dev-aws-sns-batch-fail"
          - "Repository"  = "https://github.com/dvsa/vol-app"
        } -> null
        # (15 unchanged attributes hidden)
    }

  # module.service.module.sns_batch_fail.aws_sns_topic_policy.this[0] will be destroyed
  # (because aws_sns_topic_policy.this is not in configuration)
  - resource "aws_sns_topic_policy" "this" {
      - arn    = "arn:aws:sns:eu-west-1:054614622558:vol-app-dev-batch-fail-topic-20241008100828830800000002" -> null
      - id     = "arn:aws:sns:eu-west-1:054614622558:vol-app-dev-batch-fail-topic-20241008100828830800000002" -> null
      - owner  = "054614622558" -> null
      - policy = jsonencode(
            {
              - Statement = [
                  - {
                      - Action    = [
                          - "sns:Subscribe",
                          - "sns:SetTopicAttributes",
                          - "sns:RemovePermission",
                          - "sns:Publish",
                          - "sns:ListSubscriptionsByTopic",
                          - "sns:GetTopicAttributes",
                          - "sns:DeleteTopic",
                          - "sns:AddPermission",
                        ]
                      - Condition = {
                          - StringEquals = {
                              - "AWS:SourceOwner" = "054614622558"
                            }
                        }
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "*"
                        }
                      - Resource  = "arn:aws:sns:eu-west-1:054614622558:vol-app-dev-batch-fail-topic-20241008100828830800000002"
                      - Sid       = "__default_statement_ID"
                    },
                  - {
                      - Action    = "sns:Publish"
                      - Effect    = "Allow"
                      - Principal = {
                          - AWS = "arn:aws:iam::054614622558:root"
                        }
                      - Resource  = "arn:aws:sns:eu-west-1:054614622558:vol-app-dev-batch-fail-topic-20241008100828830800000002"
                      - Sid       = "pub"
                    },
                  - {
                      - Action    = [
                          - "sns:Subscribe",
                          - "sns:Receive",
                        ]
                      - Condition = {
                          - ArnLike = {
                              - "aws:SourceArn" = ""
                            }
                        }
                      - Effect    = "Allow"
                      - Principal = {
                          - Service = "events.amazonaws.com"
                        }
                      - Resource  = "arn:aws:sns:eu-west-1:054614622558:vol-app-dev-batch-fail-topic-20241008100828830800000002"
                      - Sid       = "sub"
                    },
                ]
              - Version   = "2012-10-17"
            }
        ) -> null
    }

  # module.service.module.sns_batch_failure.data.aws_iam_policy_document.this[0] will be read during apply
  # (config refers to values not yet known)
 <= data "aws_iam_policy_document" "this" {
      + id                        = (known after apply)
      + json                      = (known after apply)
      + minified_json             = (known after apply)
      + override_policy_documents = []
      + source_policy_documents   = []

      + statement {
          + actions   = [
              + "sns:AddPermission",
              + "sns:DeleteTopic",
              + "sns:GetTopicAttributes",
              + "sns:ListSubscriptionsByTopic",
              + "sns:Publish",
              + "sns:RemovePermission",
              + "sns:SetTopicAttributes",
              + "sns:Subscribe",
            ]
          + effect    = "Allow"
          + resources = [
              + (known after apply),
            ]
          + sid       = "__default_statement_ID"

          + condition {
              + test     = "StringEquals"
              + values   = [
                  + "054614622558",
                ]
              + variable = "AWS:SourceOwner"
            }

          + principals {
              + identifiers = [
                  + "*",
                ]
              + type        = "AWS"
            }
        }
      + statement {
          + actions   = [
              + "sns:Publish",
            ]
          + resources = (known after apply)
          + sid       = "pub"

          + principals {
              + identifiers = [
                  + "arn:aws:iam::054614622558:root",
                ]
              + type        = "AWS"
            }
        }
      + statement {
          + actions   = [
              + "sns:Receive",
              + "sns:Subscribe",
            ]
          + resources = (known after apply)
          + sid       = "sub"

          + condition {
              + test     = "ArnLike"
              + values   = [
                  + null,
                ]
              + variable = "aws:SourceArn"
            }

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

  # module.service.module.sns_batch_failure.aws_sns_topic.this[0] will be created
  + resource "aws_sns_topic" "this" {
      + arn                         = (known after apply)
      + beginning_archive_time      = (known after apply)
      + content_based_deduplication = false
      + display_name                = "vol-app-dev-batch-event-failed"
      + fifo_topic                  = false
      + id                          = (known after apply)
      + name                        = (known after apply)
      + name_prefix                 = "vol-app-dev-batch-failure-topic-"
      + owner                       = (known after apply)
      + policy                      = (known after apply)
      + signature_version           = (known after apply)
      + tags                        = {
          + "Name" = "vol-app-dev-aws-sns-batch-failure"
        }
      + tags_all                    = {
          + "Environment" = "dev"
          + "Name"        = "vol-app-dev-aws-sns-batch-failure"
          + "Repository"  = "https://github.com/dvsa/vol-app"
        }
      + tracing_config              = (known after apply)
    }

  # module.service.module.sns_batch_failure.aws_sns_topic_policy.this[0] will be created
  + resource "aws_sns_topic_policy" "this" {
      + arn    = (known after apply)
      + id     = (known after apply)
      + owner  = (known after apply)
      + policy = (known after apply)
    }

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

@Wi11Shell Wi11Shell merged commit 1168502 into main Oct 9, 2024
2 checks passed
@Wi11Shell Wi11Shell deleted the 5809-batch-alarms branch October 9, 2024 12:27
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.

3 participants