Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
Added managed policy examples
Browse files Browse the repository at this point in the history
  • Loading branch information
rdunn-Hypr committed Jul 7, 2021
1 parent 1fca07c commit 1ec3177
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/managed-policy/existing-role/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform.tfvars
1 change: 1 addition & 0 deletions examples/managed-policy/existing-role/.terraform-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.12.31
28 changes: 28 additions & 0 deletions examples/managed-policy/existing-role/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module "example" {
source = "../../../managed-policy"

providers = {
aws = aws
}
create_role = false

role_name = "ExampleManagedPolicyRoleStage"

policy_name = "ExampleManagedPolicyAdditionalStage"
policy_description = "An additional example policy bound to the testing policy for the module."
policy_document_json = var.policy_document_json


tags = {"Resource Owner" = "Managed Policy Example"}
}

provider "aws" {
region = var.region

default_tags {
tags = {
"Environment" = "stage",
"Managed By" = "terraform"
}
}
}
19 changes: 19 additions & 0 deletions examples/managed-policy/existing-role/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
output "policy_name" {
value = module.example.policy_name
}

output "policy_arn" {
value = module.example.policy_arn
}

output "role_name" {
value = module.example.role_name
}

output "role_arn" {
value = module.example.role_arn
}

output "is_new_role" {
value = module.example.is_new_role
}
10 changes: 10 additions & 0 deletions examples/managed-policy/existing-role/vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

variable "region" {
type = string
default = "ap-southeast-2"
}

variable "policy_document_json" {
type = string
description = "JSON policy document"
}
1 change: 1 addition & 0 deletions examples/managed-policy/new-role/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform.tfvars
1 change: 1 addition & 0 deletions examples/managed-policy/new-role/.terraform-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.12.31
29 changes: 29 additions & 0 deletions examples/managed-policy/new-role/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module "example" {
source = "../../../managed-policy"

providers = {
aws = aws
}
create_role = true

role_name = "ExampleManagedPolicyRoleStage"
assume_role_policy_json = var.assume_role_policy_json

policy_name = "ExampleManagedPolicyStage"
policy_description = "An example policy used for testing the module."
policy_document_json = var.policy_document_json


tags = {"Resource Owner" = "Managed Policy Example"}
}

provider "aws" {
region = var.region

default_tags {
tags = {
"Environment" = "stage",
"Managed By" = "terraform"
}
}
}
19 changes: 19 additions & 0 deletions examples/managed-policy/new-role/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
output "policy_name" {
value = module.example.policy_name
}

output "policy_arn" {
value = module.example.policy_arn
}

output "role_name" {
value = module.example.role_name
}

output "role_arn" {
value = module.example.role_arn
}

output "is_new_role" {
value = module.example.is_new_role
}
15 changes: 15 additions & 0 deletions examples/managed-policy/new-role/vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

variable "region" {
type = string
default = "ap-southeast-2"
}

variable "policy_document_json" {
type = string
description = "JSON policy document"
}

variable "assume_role_policy_json" {
type = string
description = "Json policy document"
}

0 comments on commit 1ec3177

Please sign in to comment.