-
Notifications
You must be signed in to change notification settings - Fork 656
Conversation
def subscriptions | ||
subscription_arns.map do |subscription_arn| | ||
# check explicitly for an issue with some subscriptions that returns ARN=PendingConfirmation | ||
if subscription_arn == "PendingConfirmation" then next 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.
[rubocop]
- Favor modifier
if
usage when having a single-line body. Another good alternative is the usage of control flow&&
/||
. :ref
resp = @client.list_subscriptions(next_token: token) | ||
arns += resp.subscriptions.map(&:subscription_arn).flatten | ||
token = resp.next_token | ||
end until token.nil? |
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.
[rubocop]
- Use
Kernel#loop
withbreak
rather thanbegin/end/until
(orwhile
). :ref
resp = @client.list_topics(next_token: token) | ||
arns += resp.topics.map(&:topic_arn).flatten | ||
token = resp.next_token | ||
end until token.nil? |
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.
[rubocop]
- Use
Kernel#loop
withbreak
rather thanbegin/end/until
(orwhile
). :ref
|
||
module Terraforming | ||
module Resource | ||
describe SNSTopicSubscription do |
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.
[rubocop]
- Block has too many lines. [57/25]
|
||
module Terraforming | ||
module Resource | ||
describe SNSTopic do |
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.
[rubocop]
- Block has too many lines. [103/25]
client.stub_responses(:get_topic_attributes, attributes: attributes) | ||
end | ||
|
||
describe ".tf" do |
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.
[rubocop]
- Block has too many lines. [56/25]
Let me know if these large block comments from Rubocop are really important, but for now I'm assuming they aren't a huge deal within tests, since tests for other resources have comparably-sized blocks |
Sorry for late review 🙇 SNS Topics One of our SNS Topic Subscription uses resource "aws_sns_topic_subscription" "xxx" {
topic_arn = "arn:aws:sns:ap-northeast-1:xxx:dev"
protocol = "email"
endpoint = "[email protected]"
raw_message_delivery = "false"
} $ terraform plan
1 error(s) occurred:
* aws_sns_topic_subscription.xxx: Unsupported protocol (email) for SNS Topic I have a suggestion 💡 if a SNS subscription uses
|
end | ||
|
||
def tfstate | ||
subscriptions.reject{|x| x["Protocol"].include?("email")} |
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.
[rubocop]
- Space missing to the left of {.
- Space between { and | missing.
- Space missing inside }.
1 similar comment
|
||
module Terraforming | ||
module Resource | ||
describe SNSTopicSubscription do |
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.
[rubocop]
- Block has too many lines. [81/25]
I can't see what's going on in the SideCI tests, so I can't tell why that's failing but everything on my end appears to work properly... Let me know if this update helped. Should now produce no tfstate and commented tf. Thanks for the advice! @dtan4 |
SideCI says the lines of method exceeds threshold... but it's not a important issue. You can ignore it. I checked the behavior again with the latest patch, and it suceeded! |
This PR adds support for SNS Topics and Subscriptions
Please see "topic_arns" in sns_topic.rb for an example of paging AWS results to ensure arbitrary numbers of resources can be imported.