Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
terraform-aws-ec2-instance
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Terraform Modules
terraform-aws-ec2-instance
Commits
19e05849
Commit
19e05849
authored
Mar 22, 2019
by
Javier Jardón
Committed by
Anton Babenko
Mar 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
main.tf: Make number of instances created configurable, defaulting to 1 (#64)
parent
8c30ae45
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
14 deletions
+16
-14
main.tf
examples/volume-attachment/main.tf
+8
-4
outputs.tf
examples/volume-attachment/outputs.tf
+5
-10
variables.tf
examples/volume-attachment/variables.tf
+3
-0
No files found.
examples/volume-attachment/main.tf
View file @
19e05849
...
...
@@ -49,7 +49,7 @@ module "security_group" {
module
"ec2"
{
source
=
"../../"
instance_count
=
1
instance_count
=
"
${
var
.
instances_number
}
"
name
=
"example-with-ebs"
ami
=
"
${data
.
aws_ami
.
amazon_linux
.
id
}
"
...
...
@@ -60,12 +60,16 @@ module "ec2" {
}
resource
"aws_volume_attachment"
"this_ec2"
{
count
=
"
${
var
.
instances_number
}
"
device_name
=
"/dev/sdh"
volume_id
=
"
${
aws_ebs_volume
.
this
.
id
}
"
instance_id
=
"
${module
.
ec2
.
id
[
0
]
}
"
volume_id
=
"
${
aws_ebs_volume
.
this
.
*
.
id
[
count
.
index
]
}
"
instance_id
=
"
${module
.
ec2
.
id
[
count
.
index
]
}
"
}
resource
"aws_ebs_volume"
"this"
{
availability_zone
=
"
${module
.
ec2
.
availability_zone
[
0
]
}
"
count
=
"
${
var
.
instances_number
}
"
availability_zone
=
"
${module
.
ec2
.
availability_zone
[
count
.
index
]
}
"
size
=
1
}
examples/volume-attachment/outputs.tf
View file @
19e05849
output
"instance_id"
{
description
=
"EC2 instance ID"
value
=
"
${module
.
ec2
.
id
[
0
]
}
"
}
output
"instance_public_dns"
{
description
=
"Public DNS name assigned to the EC2 instance"
value
=
"
${module
.
ec2
.
public_dns
[
0
]
}
"
output
"instances_public_ips"
{
description
=
"Public IPs assigned to the EC2 instance"
value
=
"
${module
.
ec2
.
public_ip
}
"
}
output
"ebs_volume_attachment_id"
{
description
=
"The volume ID"
value
=
"
${
aws_volume_attachment
.
this_ec2
.
volume_id
}
"
value
=
"
${
aws_volume_attachment
.
this_ec2
.
*
.
volume_id
}
"
}
output
"ebs_volume_attachment_instance_id"
{
description
=
"The instance ID"
value
=
"
${
aws_volume_attachment
.
this_ec2
.
instance_id
}
"
value
=
"
${
aws_volume_attachment
.
this_ec2
.
*
.
instance_id
}
"
}
examples/volume-attachment/variables.tf
0 → 100644
View file @
19e05849
variable
"instances_number"
{
default
=
1
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment