Last active
December 3, 2017 15:31
-
-
Save clstokes/83b37413147bfcc5b213 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 hidden or 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