Skip to content

Commit 170cae6

Browse files
authored
Revert "add snsTopicArn field in polling sources (#303)" (#309)
This reverts commit 8b12418.
1 parent 4ecdd79 commit 170cae6

8 files changed

+14
-91
lines changed

sumologic/resource_sumologic_generic_polling_source.go

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -130,22 +130,6 @@ func resourceSumologicGenericPollingSource() *schema.Resource {
130130
},
131131
},
132132
},
133-
"sns_topic_or_subscription_arn": {
134-
Type: schema.TypeList,
135-
Computed: true,
136-
Elem: &schema.Resource{
137-
Schema: map[string]*schema.Schema{
138-
"is_success": {
139-
Type: schema.TypeBool,
140-
Computed: true,
141-
},
142-
"arn": {
143-
Type: schema.TypeString,
144-
Computed: true,
145-
},
146-
},
147-
},
148-
},
149133
},
150134
},
151135
}
@@ -268,13 +252,12 @@ func getPollingThirdPartyPathAttributes(pollingResource []PollingResource) []map
268252

269253
for _, t := range pollingResource {
270254
mapping := map[string]interface{}{
271-
"type": t.Path.Type,
272-
"bucket_name": t.Path.BucketName,
273-
"path_expression": t.Path.PathExpression,
274-
"limit_to_regions": t.Path.LimitToRegions,
275-
"limit_to_namespaces": t.Path.LimitToNamespaces,
276-
"tag_filters": flattenPollingTagFilters(t.Path.TagFilters),
277-
"sns_topic_or_subscription_arn": flattenPollingSnsTopicOrSubscriptionArn(t.Path.SnsTopicOrSubscriptionArn),
255+
"type": t.Path.Type,
256+
"bucket_name": t.Path.BucketName,
257+
"path_expression": t.Path.PathExpression,
258+
"limit_to_regions": t.Path.LimitToRegions,
259+
"limit_to_namespaces": t.Path.LimitToNamespaces,
260+
"tag_filters": flattenPollingTagFilters(t.Path.TagFilters),
278261
}
279262
s = append(s, mapping)
280263
}
@@ -336,32 +319,6 @@ func getPollingTagFilters(d *schema.ResourceData) []TagFilter {
336319
return filters
337320
}
338321

339-
func flattenPollingSnsTopicOrSubscriptionArn(v PollingSnsTopicOrSubscriptionArn) []map[string]interface{} {
340-
var snsTopicOrSubscriptionArn []map[string]interface{}
341-
snsTopic := map[string]interface{}{
342-
"is_success": v.IsSuccess,
343-
"arn": v.Arn,
344-
}
345-
snsTopicOrSubscriptionArn = append(snsTopicOrSubscriptionArn, snsTopic)
346-
return snsTopicOrSubscriptionArn
347-
}
348-
349-
func getPollingSnsTopicOrSubscriptionArn(d *schema.ResourceData) PollingSnsTopicOrSubscriptionArn {
350-
paths := d.Get("path").([]interface{})
351-
path := paths[0].(map[string]interface{})
352-
snsConfig := path["sns_topic_or_subscription_arn"].([]interface{})
353-
snsTopicOrSubscriptionArn := PollingSnsTopicOrSubscriptionArn{}
354-
355-
if len(snsConfig) > 0 {
356-
for _, rawConfig := range snsConfig {
357-
config := rawConfig.(map[string]interface{})
358-
snsTopicOrSubscriptionArn.IsSuccess = config["is_success"].(bool)
359-
snsTopicOrSubscriptionArn.Arn = config["arn"].(string)
360-
}
361-
}
362-
return snsTopicOrSubscriptionArn
363-
}
364-
365322
func getPollingAuthentication(d *schema.ResourceData) (PollingAuthentication, error) {
366323
auths := d.Get("authentication").([]interface{})
367324
authSettings := PollingAuthentication{}
@@ -407,7 +364,6 @@ func getPollingPathSettings(d *schema.ResourceData) (PollingPath, error) {
407364
pathSettings.Type = "S3BucketPathExpression"
408365
pathSettings.BucketName = path["bucket_name"].(string)
409366
pathSettings.PathExpression = path["path_expression"].(string)
410-
pathSettings.SnsTopicOrSubscriptionArn = getPollingSnsTopicOrSubscriptionArn(d)
411367
case "CloudWatchPath", "AwsInventoryPath":
412368
pathSettings.Type = pathType
413369
rawLimitToRegions := path["limit_to_regions"].([]interface{})

sumologic/sumologic_polling_source.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ type PollingAuthentication struct {
3333
}
3434

3535
type PollingPath struct {
36-
Type string `json:"type"`
37-
BucketName string `json:"bucketName,omitempty"`
38-
PathExpression string `json:"pathExpression,omitempty"`
39-
LimitToRegions []string `json:"limitToRegions,omitempty"`
40-
LimitToNamespaces []string `json:"limitToNamespaces,omitempty"`
41-
TagFilters []TagFilter `json:"tagFilters,omitempty"`
42-
SnsTopicOrSubscriptionArn PollingSnsTopicOrSubscriptionArn `json:"snsTopicOrSubscriptionArn,omitempty"`
36+
Type string `json:"type"`
37+
BucketName string `json:"bucketName,omitempty"`
38+
PathExpression string `json:"pathExpression,omitempty"`
39+
LimitToRegions []string `json:"limitToRegions,omitempty"`
40+
LimitToNamespaces []string `json:"limitToNamespaces,omitempty"`
41+
TagFilters []TagFilter `json:"tagFilters,omitempty"`
4342
}
4443

4544
type TagFilter struct {
@@ -48,11 +47,6 @@ type TagFilter struct {
4847
Tags []string `json:"tags"`
4948
}
5049

51-
type PollingSnsTopicOrSubscriptionArn struct {
52-
IsSuccess bool `json:"isSuccess"`
53-
Arn string `json:"arn"`
54-
}
55-
5650
func (s *Client) CreatePollingSource(source PollingSource, collectorID int) (int, error) {
5751

5852
type PollingSourceMessage struct {

website/docs/index.html.markdown

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -130,20 +130,4 @@ The following properties are common to ALL sources and can be used to configure
130130
- `cutoff_relative_time` - (Optional) Can be specified instead of cutoffTimestamp to provide a relative offset with respect to the current time. Example: use -1h, -1d, or -1w to collect data that's less than one hour, one day, or one week old, respectively.
131131
- `fields` - (Optional) Map containing key/value pairs.
132132

133-
## Configuring SNS Subscription
134-
This is supported in the following resources.
135-
- `sumologic_cloudfront_source`
136-
- `sumologic_cloudtrail_source`
137-
- `sumologic_elb_source`
138-
- `sumologic_s3_audit_source`
139-
- `sumologic_s3_source`
140-
141-
Steps to configure SNS subscription and sync the state in terrform:
142-
- Step 1: Create the source via terraform.
143-
- Step 2: Setup [SNS subscription][3] outside of terraform on Sumologic UI.
144-
- Step 3: Run `terraform plan -refresh-only` to review the changes and verify the state with the SNS subscription information. Make sure only `sns_topic_or_subscription_arn` is updated. If SNS has been successfully configured and has received a subscription confirmation request `isSuccess` parameter will be true.
145-
- Step 4: Apply the changes with `terraform apply -refresh-only`.
146-
147133
[2]: https://en.wikipedia.org/wiki/Tz_database
148-
[3]: https://help.sumologic.com/03Send-Data/Sources/02Sources-for-Hosted-Collectors/Amazon-Web-Services/AWS_Sources#set-up-sns-in-aws-highly-recommended
149-

website/docs/r/cloudfront_source.html.markdown

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ In addition to the common properties, the following arguments are supported:
5858
+ `type` - (Required) type of polling source. This has to be `S3BucketPathExpression` for `CloudFront` source.
5959
+ `bucket_name` - (Required) The name of the bucket. This is needed if using type `S3BucketPathExpression`.
6060
+ `path_expression` - (Required) The path to the data. This is needed if using type `S3BucketPathExpression`.
61-
+ `sns_topic_or_subscription_arn` - (Computed) This is a computed field for SNS topic/subscription ARN.
6261

6362
### See also
6463
* [Common Source Properties](https://registry.terraform.io/providers/SumoLogic/sumologic/latest/docs#common-source-properties)
65-
* [Configuring SNS Subscription](https://registry.terraform.io/providers/SumoLogic/sumologic/latest/docs#configuring-sns-subscription)
6664

6765
## Attributes Reference
6866
The following attributes are exported:
@@ -84,4 +82,4 @@ terraform import sumologic_cloudfront_source.test my-test-collector/my-test-sour
8482
```
8583

8684
[1]: https://help.sumologic.com/Send_Data/Sources/03Use_JSON_to_Configure_Sources/JSON_Parameters_for_Hosted_Sources
87-
[2]: https://help.sumologic.com/03Send-Data/Sources/02Sources-for-Hosted-Collectors/Amazon-Web-Services/Amazon-CloudFront-Source
85+
[2]: https://help.sumologic.com/03Send-Data/Sources/02Sources-for-Hosted-Collectors/Amazon-Web-Services/Amazon-CloudFront-Source

website/docs/r/cloudtrail_source.html.markdown

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,9 @@ In addition to the common properties, the following arguments are supported:
5858
+ `type` - (Required) type of polling source. This has to be `S3BucketPathExpression` for `CloudTrail` source.
5959
+ `bucket_name` - (Required) The name of the bucket.
6060
+ `path_expression` - (Required) The path to the data.
61-
+ `sns_topic_or_subscription_arn` - (Computed) This is a computed field for SNS topic/subscription ARN.
62-
6361

6462
### See also
6563
* [Common Source Properties](https://registry.terraform.io/providers/SumoLogic/sumologic/latest/docs#common-source-properties)
66-
* [Configuring SNS Subscription](https://registry.terraform.io/providers/SumoLogic/sumologic/latest/docs#configuring-sns-subscription)
6764

6865
## Attributes Reference
6966
The following attributes are exported:
@@ -85,4 +82,4 @@ terraform import sumologic_cloudtrail_source.test my-test-collector/my-test-sour
8582
```
8683

8784
[1]: https://help.sumologic.com/Send_Data/Sources/03Use_JSON_to_Configure_Sources/JSON_Parameters_for_Hosted_Sources
88-
[2]: https://help.sumologic.com/03Send-Data/Sources/02Sources-for-Hosted-Collectors/Amazon-Web-Services/AWS-CloudTrail-Source
85+
[2]: https://help.sumologic.com/03Send-Data/Sources/02Sources-for-Hosted-Collectors/Amazon-Web-Services/AWS-CloudTrail-Source

website/docs/r/elb_source.html.markdown

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ In addition to the common properties, the following arguments are supported:
5858
+ `type` - (Required) type of polling source. This has to be `S3BucketPathExpression` for `ELB` source.
5959
+ `bucket_name` - (Required) The name of the bucket.
6060
+ `path_expression` - (Required) The path to the data.
61-
+ `sns_topic_or_subscription_arn` - (Computed) This is a computed field for SNS topic/subscription ARN.
6261

6362
### See also
6463
* [Common Source Properties](https://registry.terraform.io/providers/SumoLogic/sumologic/latest/docs#common-source-properties)
65-
* [Configuring SNS Subscription](https://registry.terraform.io/providers/SumoLogic/sumologic/latest/docs#configuring-sns-subscription)
6664

6765
## Attributes Reference
6866
The following attributes are exported:

website/docs/r/s3_audit_source.markdown

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ In addition to the common properties, the following arguments are supported:
5858
+ `type` - (Required) type of polling source. This has to be `S3BucketPathExpression` for `S3 Audit source`.
5959
+ `bucket_name` - (Required) The name of the bucket.
6060
+ `path_expression` - (Required) The path to the data.
61-
+ `sns_topic_or_subscription_arn` - (Computed) This is a computed field for SNS topic/subscription ARN.
6261

6362
### See also
6463
* [Common Source Properties](https://registry.terraform.io/providers/SumoLogic/sumologic/latest/docs#common-source-properties)
65-
* [Configuring SNS Subscription](https://registry.terraform.io/providers/SumoLogic/sumologic/latest/docs#configuring-sns-subscription)
6664

6765
## Attributes Reference
6866
The following attributes are exported:

website/docs/r/s3_source.html.markdown

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ In addition to the common properties, the following arguments are supported:
5858
+ `type` - (Required) type of polling source. This has to be `S3BucketPathExpression` for `S3 source`.
5959
+ `bucket_name` - (Required) The name of the bucket.
6060
+ `path_expression` - (Required) The path to the data.
61-
+ `sns_topic_or_subscription_arn` - (Computed) This is a computed field for SNS topic/subscription ARN.
6261

6362
### See also
6463
* [Common Source Properties](https://github.com/SumoLogic/tree/master/website#common-source-properties)
65-
* [Configuring SNS Subscription](https://registry.terraform.io/providers/SumoLogic/sumologic/latest/docs#configuring-sns-subscription)
6664

6765
## Attributes Reference
6866
The following attributes are exported:

0 commit comments

Comments
 (0)