This repository has been archived by the owner on Sep 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 657
Fix associate_public_ip_address attr for EC2 #287
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 similar comment
dtan4
suggested changes
Nov 21, 2016
@@ -96,6 +96,10 @@ def in_vpc?(instance) | |||
(instance.subnet_id && instance.subnet_id != "" && instance.security_groups.empty?) | |||
end | |||
|
|||
def associate_public_ip?(instance) | |||
(instance.public_ip_address.to_s.empty?) ? "false" : "true" | |||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should return boolean value:
def associate_public_ip_address?(instance)
!instance.public_ip_address.to_s.empty?
end
and both tf
and tfstate
should call this method.
tf:
associate_public_ip_address = <%= associate_public_ip_address?(instance) %>
tfstate:
"associate_public_ip_address?(instance).to_s
diwaniuk
force-pushed
the
ec2_associate_public_ip
branch
from
December 3, 2016 11:37
f638e6e
to
dee0f52
Compare
Fixed. |
dtan4
suggested changes
Dec 4, 2016
@@ -96,6 +96,10 @@ def in_vpc?(instance) | |||
(instance.subnet_id && instance.subnet_id != "" && instance.security_groups.empty?) | |||
end | |||
|
|||
def associate_public_ip?(instance) | |||
(instance.public_ip_address.to_s.empty?) ? false : true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm... String#empty?
returns boolean value, true
or false
, so this can be written more simply,
!instance.public_ip_address.to_s.empty?
diwaniuk
force-pushed
the
ec2_associate_public_ip
branch
from
December 4, 2016 16:44
dee0f52
to
6ff9782
Compare
dtan4
approved these changes
Dec 11, 2016
LGTM 👍 Thanks ❗️ |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix hardcoded value for associate_public_ip_address attribute from "true" to dynamic based on public_ip_address state.