-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
45 lines (38 loc) · 1.09 KB
/
main.tf
File metadata and controls
45 lines (38 loc) · 1.09 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
module "elastio_asset_account" {
source = "../../"
template_url = var.template_url
iam_role_arn = time_sleep.iam.triggers.deployer_role_arn
}
resource "aws_iam_role" "deployer" {
name = "ElastioAssetAccountDeployer"
assume_role_policy = jsonencode(
{
"Version" : "2012-10-17",
"Statement" : [
{
"Effect" : "Allow",
"Principal" : {
"Service" : "cloudformation.amazonaws.com"
},
"Action" : "sts:AssumeRole"
}
]
}
)
}
resource "aws_iam_role_policy_attachment" "elastio_asset_account_deployer" {
role = aws_iam_role.deployer.name
policy_arn = module.elastio_policies.policies.ElastioAssetAccountDeployer.arn
}
module "elastio_policies" {
source = "../../../../../iam-policies/terraform"
policies = ["ElastioAssetAccountDeployer"]
}
# Wait for the IAM role and policies to propagate
resource "time_sleep" "iam" {
create_duration = "20s"
depends_on = [aws_iam_role_policy_attachment.elastio_asset_account_deployer]
triggers = {
deployer_role_arn = aws_iam_role.deployer.arn
}
}