-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.tf
More file actions
94 lines (79 loc) · 1.99 KB
/
Copy pathdata.tf
File metadata and controls
94 lines (79 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
data "aws_ecr_repository" "profile_lambda_ecr_repo" {
name = var.ecr_repository
}
data "aws_ecr_image" "lambda_image" {
repository_name = data.aws_ecr_repository.profile_lambda_ecr_repo.name
image_tag = var.container_ver
}
# Get the ecs infrastructure outputs from the remote state data source
data "terraform_remote_state" "vpc" {
backend = "s3"
config = {
bucket = "${var.env_name}-tf-state"
key = "${var.env_name}-ecs-infra/terraform.tfstate"
region = "eu-west-2"
}
}
data "aws_iam_policy_document" "vpc_permissions" {
statement {
effect = "Allow"
actions = [
"ec2:DescribeNetworkInterfaces",
"ec2:CreateNetworkInterface",
"ec2:DeleteNetworkInterface",
"ec2:DescribeInstances",
"ec2:AttachNetworkInterface",
"ec2:CreateTags"
]
resources = ["*"]
}
}
data "aws_iam_policy_document" "lambda_logging" {
statement {
effect = "Allow"
actions = [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
]
resources = [
"${aws_cloudwatch_log_group.loggroup.arn}:*"
]
}
}
data "aws_iam_policy_document" "lambda_s3_policy" {
statement {
effect = "Allow"
actions = [
"s3:ListAllMyBuckets", # Allows listing all buckets in the account
"s3:GetObject", # Allows reading objects in buckets
"s3:ListBucket"
]
resources = [
"arn:aws:s3:::*", # Allows access to all buckets
"arn:aws:s3:::*/*" # Allows access to all objects within all buckets
]
}
}
data "aws_iam_policy_document" "lambda_secret_manager_policy" {
statement {
effect = "Allow"
actions = [
"secretsmanager:GetSecretValue"
]
resources = [
"arn:aws:secretsmanager:*:*:secret:${var.aws_secret_name}*"
]
}
}
data "aws_iam_policy_document" "lambda_eventbridge_policy" {
statement {
effect = "Allow"
actions = [
"lambda:InvokeFunction"
]
resources = [
aws_lambda_function.lambda_function.arn
]
}
}