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
bc0a43c6
Commit
bc0a43c6
authored
Jun 15, 2019
by
Anton Babenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed when private_ips is empty (fixed #103)
parent
cbc3bb20
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
24 deletions
+17
-24
main.tf
examples/basic/main.tf
+11
-10
main.tf
main.tf
+6
-14
No files found.
examples/basic/main.tf
View file @
bc0a43c6
...
...
@@ -67,7 +67,7 @@ module "ec2" {
ami
=
data
.
aws_ami
.
amazon_linux
.
id
instance_type
=
"c5.large"
subnet_id
=
tolist
(
data
.
aws_subnet_ids
.
all
.
ids
)
[
0
]
private_ip
=
[
"123.0.0.1"
,
"123.0.0.2
"
]
// private_ips = ["172.31.32.5", "172.31.46.20
"]
vpc_security_group_ids
=
[
module
.
security_group
.
this_security_group_id
]
associate_public_ip_address
=
true
placement_group
=
aws_placement_group
.
web
.
id
...
...
@@ -95,6 +95,7 @@ module "ec2_with_t2_unlimited" {
instance_type
=
"t2.micro"
cpu_credits
=
"unlimited"
subnet_id
=
tolist
(
data
.
aws_subnet_ids
.
all
.
ids
)
[
0
]
// private_ip = "172.31.32.10"
vpc_security_group_ids
=
[
module
.
security_group
.
this_security_group_id
]
associate_public_ip_address
=
true
}
...
...
main.tf
View file @
bc0a43c6
...
...
@@ -24,10 +24,7 @@ resource "aws_instance" "this" {
iam_instance_profile
=
var
.
iam_instance_profile
associate_public_ip_address
=
var
.
associate_public_ip_address
private_ip
=
element
(
distinct
(
compact
(
concat
(
[
var
.
private_ip
]
,
var
.
private_ips
))),
count
.
index
,
)
private_ip
=
length
(
var
.
private_ips
)
>
0
?
element
(
var
.
private_ips
,
count
.
index
)
:
var
.
private_ip
ipv6_address_count
=
var
.
ipv6_address_count
ipv6_addresses
=
var
.
ipv6_addresses
...
...
@@ -90,7 +87,6 @@ resource "aws_instance" "this" {
# (eg, https://github.com/terraform-providers/terraform-provider-aws/issues/2036)
# we have to ignore changes in the following arguments
ignore_changes
=
[
private_ip
,
root_block_device
,
ebs_block_device
,
]
...
...
@@ -113,10 +109,7 @@ resource "aws_instance" "this_t2" {
iam_instance_profile
=
var
.
iam_instance_profile
associate_public_ip_address
=
var
.
associate_public_ip_address
private_ip
=
element
(
distinct
(
compact
(
concat
(
[
var
.
private_ip
]
,
var
.
private_ips
))),
count
.
index
,
)
private_ip
=
length
(
var
.
private_ips
)
>
0
?
element
(
var
.
private_ips
,
count
.
index
)
:
var
.
private_ip
ipv6_address_count
=
var
.
ipv6_address_count
ipv6_addresses
=
var
.
ipv6_addresses
...
...
@@ -183,7 +176,6 @@ resource "aws_instance" "this_t2" {
# (eg, https://github.com/terraform-providers/terraform-provider-aws/issues/2036)
# we have to ignore changes in the following arguments
ignore_changes
=
[
private_ip
,
root_block_device
,
ebs_block_device
,
]
...
...
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