Skip to content

Commit

Permalink
fixed some errors in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
dsreehas committed May 2, 2024
1 parent ec747bf commit c6ea329
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 76 deletions.
Binary file modified examples/eks-role/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion examples/multiple-inline-policies/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ variable "aws_profile" {
variable "role_name" {
description = "Name of the IAM role"
type = string
default = "multiple-inline-policies-role"
default = "new-multiple-inline-policies-role"
}
15 changes: 7 additions & 8 deletions examples/multiple-managed-policies/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
module "iam_role_with_managed_policies" {
source = "/Users/user/Documents/GitHub/terraform-eks-iam-role/"
role_name = var.role_name
assume_role_policy = file("./policies/assume_role_policy.json")
managed_policy_arns = var.managed_policy_arns
description = var.role_description
source = "/Users/user/Documents/GitHub/terraform-eks-iam-role/"
role_name = var.role_name
role_description = var.role_description
assume_role_policy = file("./policies/assume_role_policy.json")
managed_policy_arns = var.managed_policy_arns
max_session_duration = var.max_session_duration
path = var.path
path = var.path
permissions_boundary = var.permissions_boundary
tags = var.tags

tags = var.tags
}
22 changes: 1 addition & 21 deletions examples/multiple-managed-policies/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
# output "iam_role_with_managed_policies_arn" {
# description = "The Amazon Resource Name (ARN) specifying the IAM role with managed policies"
# value = module.iam_role_with_managed_policies.iam_role_arn
# }

# output "iam_role_with_managed_policies_name" {
# description = "Name of the IAM role with managed policies"
# value = module.iam_role_with_managed_policies.iam_role_name
# }

# output "iam_role_with_managed_policies_assume_role_policy" {
# description = "IAM assume role policy associated with the role with managed policies"
# value = module.iam_role_with_managed_policies.iam_role_assume_role_policy
# }

# output "iam_role_with_managed_policies_managed_policy_arns" {
# description = "Managed policy ARNs attached to the IAM role with managed policies"
# value = module.iam_role_with_managed_policies.iam_role_managed_policy_arns
# }

output "iam_role_with_managed_policies_arn" {
description = "The Amazon Resource Name (ARN) specifying the IAM role with managed policies"
value = module.iam_role_with_managed_policies.iam_role_arn
Expand Down Expand Up @@ -71,4 +51,4 @@ output "iam_role_with_managed_policies_tags" {
output "iam_instance_profile_arn" {
description = "The ARN of the instance profile"
value = module.iam_role_with_managed_policies.iam_instance_profile_arn
}
}
6 changes: 3 additions & 3 deletions examples/multiple-managed-policies/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ variable "aws_profile" {
variable "role_name" {
description = "Name of the IAM role"
type = string
default = "multiple-managed-policies-role"
default = "testing-multiple-managed-policies-role"
}

variable "role_description" {
description = "Description of the IAM role"
type = string
default = "This is my IAM role for EC2 instances"
default = "test-description"
}

variable "managed_policy_arns" {
Expand All @@ -43,7 +43,7 @@ variable "path" {
variable "permissions_boundary" {
description = "Permissions boundary for the IAM role"
type = string
default = "arn:aws:iam::123456789012:policy/MyPermissionsBoundary"
default = "arn:aws:iam::aws:policy/AmazonEC2FullAccess"
}

variable "tags" {
Expand Down
19 changes: 10 additions & 9 deletions examples/test/main.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
module "iam_role_with_managed_policies" {
source = "/Users/user/Documents/GitHub/terraform-eks-iam-role/"
role_name = var.role_name
assume_role_policy = file("./policies/assume_role_policy.json")
source = "/Users/user/Documents/GitHub/terraform-eks-iam-role/"

role_name = var.role_name
role_description = var.role_description
assume_role_policy = file("./policies/assume_role_policy.json")
managed_policy_arns = var.managed_policy_arns
# description = var.role_description

max_session_duration = var.max_session_duration
path = var.path
# permissions_boundary = var.permissions_boundary
tags = var.tags

}
path = var.path
permissions_boundary = var.permissions_boundary
tags = var.tags
}
2 changes: 1 addition & 1 deletion examples/test/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ output "iam_role_with_managed_policies_tags" {
output "iam_instance_profile_arn" {
description = "The ARN of the instance profile"
value = module.iam_role_with_managed_policies.iam_instance_profile_arn
}
}
4 changes: 2 additions & 2 deletions examples/test/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ variable "role_name" {
variable "role_description" {
description = "Description of the IAM role"
type = string
default = null
default = "test-description"
}

variable "managed_policy_arns" {
Expand All @@ -43,7 +43,7 @@ variable "path" {
variable "permissions_boundary" {
description = "Permissions boundary for the IAM role"
type = string
default = "arn:aws:iam::123456789012:policy/MyPermissionsBoundary"
default = "arn:aws:iam::aws:policy/AmazonEC2FullAccess"
}

variable "tags" {
Expand Down
1 change: 0 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ resource "aws_iam_role" "iam_role" {
max_session_duration = var.max_session_duration
path = var.path
permissions_boundary = var.permissions_boundary

tags = var.tags
}

Expand Down
30 changes: 0 additions & 30 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
# output "iam_role_arn" {
# description = "ARN of the IAM role"
# value = aws_iam_role.iam_role.arn
# }

# output "iam_role_name" {
# description = "Name of the IAM role"
# value = aws_iam_role.iam_role.name
# }

# output "iam_role_assume_role_policy" {
# description = "IAM assume role policy associated with the role"
# value = aws_iam_role.iam_role.assume_role_policy
# }

# output "iam_role_inline_policies" {
# description = "Inline policies attached to the IAM role"
# value = aws_iam_role_policy.inline_policies[*].policy
# }

# output "iam_role_managed_policy_arns" {
# description = "Managed policy ARNs attached to the IAM role"
# value = aws_iam_role_policy_attachment.managed_policy_attachments[*].policy_arn
# }

# output "iam_instance_profile_arn" {
# description = "The ARN of the instance profile"
# value = try(aws_iam_instance_profile.instance_profile[0].arn, null)

# }
output "iam_role_arn" {
description = "ARN of the IAM role"
value = aws_iam_role.iam_role.arn
Expand Down

0 comments on commit c6ea329

Please sign in to comment.