-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resource/aws_inspector_assessment_target: subscribe-to-event #3957
Conversation
Can we get this merged? I have use of this as well |
+1: We also need SNS subscription to Inspector. |
+1: Please merge |
Any update on this? |
Hi @bflad! |
Would love to see this merged as well. |
return fmt.Sprintf(testAccAWSInspectorTemplateAssessmentConfig, "", "") | ||
} | ||
|
||
func testAccAWSInspectorTemplateAssessmentConfigTwoEventSubscritpions() string { |
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 function name is misspelled (Subscritpions), should probably be testAccAWSInspectorTemplateAssessmentConfigTwoEventSubscriptions
%s | ||
}` | ||
|
||
var AWSInspectorTwoEventSubscriptions = ` |
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.
these don't need to be exported
"event": { | ||
Type: schema.TypeString, | ||
Required: true, | ||
ValidateFunc: validateSubscribeToEvent, |
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.
please use validation.StringInSlice
instead
@@ -119,3 +228,68 @@ func resourceAwsInspectorAssessmentTemplateDelete(d *schema.ResourceData, meta i | |||
|
|||
return nil | |||
} | |||
|
|||
// validateSubscribeToEvent validates the string is a known keyword |
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.
can remove this once you swap validation to validation.StringInSlice
|
||
Provides a Inspector assessment target | ||
|
||
## Example Usage | ||
|
||
```hcl |
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 should stay, the language of the example is hcl
}, | ||
}, | ||
}, | ||
Set: func(v interface{}) int { |
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 is unnecessary, the hash by default will contain all the keys.
}, | ||
"topic_arn": { | ||
Type: schema.TypeString, | ||
Required: 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.
You can use ValidateFunc: validateArn
here (see https://github.com/terraform-providers/terraform-provider-aws/blob/b797d11058d9293aa9cd95eb54c39883d5813756/aws/validators.go#L470:6)
} | ||
|
||
// substractEventSubscriptions return elements of 'a' which are not contained in 'b' | ||
func substractEventSubscriptions(a []map[string]interface{}, b []map[string]interface{}) (result []map[string]interface{}) { |
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.
schema.Set
has a Difference
function that would make this cleaner, can probably eliminate it
return | ||
} | ||
|
||
func containsEventSubscription(s []map[string]interface{}, e map[string]interface{}) bool { |
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.
schema.Set
has a Contains
function that would make this cleaner, can probably eliminate it
Hi there, what's the status of this merge request? I've just ran into this issue as well, where I'm unable to associate an AWS Inspector template with an SNS topic via Terraform. |
Any status on resolving conflicts & finishing this merge? |
Any updates here? |
Hi all Is there any update on this as I have a pending need for this functionality also. Thanks |
@s-maj will you continue working on this branch or has this PR been abandoned? |
we need this |
FYI, my workaround:
|
Hi folks 👋 Since there has been no activity with this pull request, especially in response to the requested changes from a year ago and the current merge conflicts, we are going to close this. If the original author or a community member has the ambition to continue working on this, please submit a new pull request and the maintainers will take a fresh look. Thanks. |
I submitted PR #12261 to address this issue. I'd appreciate if you thumb'd it up for visibility. Thanks 👍 |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Based on PR: hashicorp/terraform#13534
Fixes: #843
Fixed tests and added retries to avoid SNS Topic policy eventual consistency issues.