added new files

This commit is contained in:
Jun-te Kim 2026-02-11 13:16:11 +00:00
parent ffb840da81
commit 203843c387
4 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,14 @@
output "address2uprn_queue_url" {
value = module.address2uprn.queue_url
description = "URL of the address2UPRN SQS queue"
}
output "address2uprn_queue_arn" {
value = module.address2uprn.queue_arn
description = "ARN of the address2UPRN SQS queue"
}
output "address2uprn_lambda_arn" {
value = module.address2uprn.lambda_arn
description = "ARN of the address2UPRN Lambda function"
}

View file

@ -0,0 +1,21 @@
# IAM Policy with dynamic actions and resources
resource "aws_iam_policy" "policy" {
name = var.policy_name
description = var.policy_description
policy = jsonencode({
Version = "2012-10-17"
Statement = [
merge(
{
Effect = "Allow"
Action = var.actions
Resource = var.resources
},
var.conditions != null ? { Condition = var.conditions } : {}
)
]
})
tags = var.tags
}

View file

@ -0,0 +1,9 @@
output "policy_arn" {
value = aws_iam_policy.policy.arn
description = "ARN of the created IAM policy"
}
output "policy_name" {
value = aws_iam_policy.policy.name
description = "Name of the created IAM policy"
}

View file

@ -0,0 +1,32 @@
variable "policy_name" {
description = "Name of the IAM policy"
type = string
}
variable "policy_description" {
description = "Description of the IAM policy"
type = string
default = ""
}
variable "actions" {
description = "List of IAM actions allowed by this policy"
type = list(string)
}
variable "resources" {
description = "List of AWS resources this policy applies to"
type = list(string)
}
variable "conditions" {
description = "Optional IAM policy conditions"
type = any
default = null
}
variable "tags" {
description = "Tags to apply to the policy"
type = map(string)
default = {}
}