Skip to content

Commit

Permalink
add insyance id to outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
zahornyak committed Apr 18, 2024
1 parent fa4e5cd commit f8d9ea7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ module "ec2" {
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 4.45 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.45 |
| <a name="requirement_template"></a> [template](#requirement\_template) | ~> 2.2 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.45 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.45 |
| <a name="provider_template"></a> [template](#provider\_template) | ~> 2.2 |

## Modules
Expand Down Expand Up @@ -82,6 +82,7 @@ module "ec2" {
| <a name="output_ami_id"></a> [ami\_id](#output\_ami\_id) | ami id |
| <a name="output_ec2_instance_profile"></a> [ec2\_instance\_profile](#output\_ec2\_instance\_profile) | ec2\_instance\_profile |
| <a name="output_eip_ip"></a> [eip\_ip](#output\_eip\_ip) | public ip of instance |
| <a name="output_instance_id"></a> [instance\_id](#output\_instance\_id) | instance id |
| <a name="output_instance_role"></a> [instance\_role](#output\_instance\_role) | ec2\_instance\_profile |
| <a name="output_private_ip"></a> [private\_ip](#output\_private\_ip) | private ip of instance |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,9 @@ output "instance_role" {
output "ec2_instance_profile" {
value = var.instance_profile == null ? aws_iam_instance_profile.ec2_instance_profile[0].name : null
description = "ec2_instance_profile"
}

output "instance_id" {
value = try(module.ec2_instance[0].id, null)
description = "instance id"
}
10 changes: 8 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
terraform {
required_version = ">= 1.3"
required_providers {
aws = "~> 4.45"
template = "~> 2.2"
aws = {
source = "hashicorp/aws"
version = ">= 4.45"
}
template = {
source = "hashicorp/template"
version = "~> 2.2"
}
}
}

0 comments on commit f8d9ea7

Please sign in to comment.