-
-
Save diogoaurelio/4a3426721928c1e19c61963d19177399 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "role_name" {} | |
variable "role_policy_file" {} | |
resource "aws_iam_role" "role" { | |
name = "${var.role_name}" | |
assume_role_policy = "${file("${path.module}/policies/${var.role_policy_file}")}" | |
} | |
output "role_arn" { | |
value = "${aws_iam_role.role.arn}" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Directory structure | |
* . | |
* ├── main.tf | |
* ├── modules | |
* │ └── iam_role | |
* │ ├── iam.tf | |
* │ └── policies | |
* │ ├── differentname_policy.json | |
* │ └── exampleroles_policy.json | |
*/ | |
module "role_exampleroles" { | |
source = "./modules/iam_role" | |
role_name = "exampleroles" | |
role_policy_file = "exampleroles_policy.json" | |
} | |
module "role_differentname" { | |
source = "./modules/iam_role" | |
role_name = "differentname" | |
role_policy_file = "differentname_policy.json" | |
} | |
output "role_exampleroles_arn" { | |
value = "${module.role_exampleroles.role_arn}" | |
} | |
output "role_differentname_arn" { | |
value = "${module.role_differentname.role_arn}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment