diff --git a/README.md b/README.md
index 21cac57..aa751a5 100644
--- a/README.md
+++ b/README.md
@@ -30,9 +30,10 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [assume\_role\_policy](#input\_assume\_role\_policy) | Assume role policy document | `string` | n/a | yes |
+| [instance\_profile\_name](#input\_instance\_profile\_name) | Name of the IAM Instance Profile | `string` | n/a | yes |
| [role\_name](#input\_role\_name) | Name of the IAM role | `string` | n/a | yes |
| [aws\_profile](#input\_aws\_profile) | Selected AWS profile | `string` | `null` | no |
-| [aws\_region](#input\_aws\_region) | Selected AWS region | `string` | `null` | no |
+| [aws\_region](#input\_aws\_region) | Specified AWS region | `string` | `null` | no |
| [inline\_policies](#input\_inline\_policies) | List of inline policy documents | `list(string)` | `[]` | no |
| [managed\_policy\_arns](#input\_managed\_policy\_arns) | List of managed policy ARNs | `list(string)` | `[]` | no |
diff --git a/examples/instance-profile/main.tf b/examples/instance-profile/main.tf
index 4681111..49a53e7 100644
--- a/examples/instance-profile/main.tf
+++ b/examples/instance-profile/main.tf
@@ -1,6 +1,5 @@
module "iam_role" {
- source = "github.com/dsreehas/terraform-iam-role"
-
+ source = "github.com/dsreehas/terraform-iam-role"
role_name = var.role_name
assume_role_policy = file("./policies/assume_role_policy.json")
inline_policies = [file("./policies/inline_policy_1.json"), file("./policies/inline_policy_2.json")]
@@ -10,5 +9,11 @@ module "iam_role" {
resource "aws_iam_instance_profile" "iam_instance_profile" {
name = var.instance_profile_name
role = module.iam_role.iam_role_name
-
}
+
+# resource "aws_instance" "test_instance" {
+# ami = var.instance_ami
+# instance_type = var.instance_type
+# iam_instance_profile = aws_iam_instance_profile.iam_instance_profile.arn
+
+# }
diff --git a/examples/instance-profile/variables.tf b/examples/instance-profile/variables.tf
index 1cafd38..73e07ce 100644
--- a/examples/instance-profile/variables.tf
+++ b/examples/instance-profile/variables.tf
@@ -26,3 +26,15 @@ variable "managed_policy_arns" {
type = list(string)
default = ["arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess", "arn:aws:iam::aws:policy/CloudWatchLogsReadOnlyAccess"]
}
+
+variable "instance_ami" {
+ description = "EC2 instance AMI"
+ type = string
+ default = "ami-0c94855ba95c71c99"
+}
+
+variable "instance_type" {
+ description = "EC2 instance type"
+ type = string
+ default = "t2.micro"
+}
diff --git a/main.tf b/main.tf
index 8170d42..162ea7e 100644
--- a/main.tf
+++ b/main.tf
@@ -21,7 +21,7 @@ resource "aws_iam_role_policy_attachment" "managed_policy_attachments" {
# Create IAM instance profile
resource "aws_iam_instance_profile" "instance_profile" {
- name = "${var.role_name}-instance-profile"
+ name = var.instance_profile_name
role = aws_iam_role.iam_role.name
}
diff --git a/outputs.tf b/outputs.tf
index dbe19c2..7a372fe 100644
--- a/outputs.tf
+++ b/outputs.tf
@@ -23,12 +23,12 @@ output "iam_role_managed_policy_arns" {
value = aws_iam_role_policy_attachment.managed_policy_attachments[*].policy_arn
}
-output "iam_instance_profile_arn" {
- description = "The ARN of the instance profile"
- value = aws_iam_instance_profile.instance_profile.arn
-}
-
output "iam_instance_profile_name" {
description = "The name of the instance profile"
value = aws_iam_instance_profile.instance_profile.name
}
+
+output "iam_instance_profile_arn" {
+ description = "The ARN of the instance profile"
+ value = aws_iam_instance_profile.instance_profile.arn
+}
diff --git a/variables.tf b/variables.tf
index 1ff053e..086c4ef 100644
--- a/variables.tf
+++ b/variables.tf
@@ -1,5 +1,5 @@
variable "aws_region" {
- description = "Selected AWS region"
+ description = "Specified AWS region"
type = string
default = null
@@ -32,3 +32,8 @@ variable "managed_policy_arns" {
type = list(string)
default = []
}
+
+variable "instance_profile_name" {
+ description = "Name of the IAM Instance Profile"
+ type = string
+}