Skip to content

Commit ad1862e

Browse files
committed
Merge branch 'apoorv-inventory-source' of ssh://github.com/SumoLogic/terraform-provider-sumologic into apoorv-inventory-source
2 parents 8be0676 + df17832 commit ad1862e

File tree

3 files changed

+87
-2
lines changed

3 files changed

+87
-2
lines changed

sumologic/provider.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ func Provider() terraform.ResourceProvider {
4545
"sumologic_s3_audit_source": resourceSumologicGenericPollingSource(),
4646
"sumologic_cloudwatch_source": resourceSumologicGenericPollingSource(),
4747
"sumologic_aws_inventory_source": resourceSumologicGenericPollingSource(),
48+
"sumologic_aws_xray_source": resourceSumologicGenericPollingSource(),
4849
"sumologic_cloudtrail_source": resourceSumologicGenericPollingSource(),
4950
"sumologic_elb_source": resourceSumologicGenericPollingSource(),
5051
"sumologic_cloudfront_source": resourceSumologicGenericPollingSource(),

sumologic/resource_sumologic_generic_polling_source.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func resourceSumologicGenericPollingSource() *schema.Resource {
2424
Required: true,
2525
ForceNew: true,
2626
ValidateFunc: validation.StringInSlice([]string{"AwsS3Bucket", "AwsElbBucket", "AwsCloudFrontBucket",
27-
"AwsCloudTrailBucket", "AwsS3AuditBucket", "AwsCloudWatch", "AwsInventory"}, false),
27+
"AwsCloudTrailBucket", "AwsS3AuditBucket", "AwsCloudWatch", "AwsInventory", "AwsXRay"}, false),
2828
}
2929
pollingSource.Schema["scan_interval"] = &schema.Schema{
3030
Type: schema.TypeInt,
@@ -78,7 +78,7 @@ func resourceSumologicGenericPollingSource() *schema.Resource {
7878
Type: schema.TypeString,
7979
Required: true,
8080
ValidateFunc: validation.StringInSlice([]string{"S3BucketPathExpression", "CloudWatchPath",
81-
"AwsInventoryPath"}, false),
81+
"AwsInventoryPath", "AwsXRayPath"}, false),
8282
},
8383
"bucket_name": {
8484
Type: schema.TypeString,
@@ -350,6 +350,14 @@ func getPollingPathSettings(d *schema.ResourceData) (PollingPath, error) {
350350
if pathType == "CloudWatchPath" {
351351
pathSettings.TagFilters = getPollingTagFilters(d)
352352
}
353+
case "AwsXRayPath":
354+
pathSettings.Type = "AwsXRayPath"
355+
rawLimitToRegions := path["limit_to_regions"].([]interface{})
356+
LimitToRegions := make([]string, len(rawLimitToRegions))
357+
for i, v := range rawLimitToRegions {
358+
LimitToRegions[i] = v.(string)
359+
}
360+
pathSettings.LimitToRegions = LimitToRegions
353361
default:
354362
errorMessage := fmt.Sprintf("[ERROR] Unknown resourceType in path: %v", pathType)
355363
log.Print(errorMessage)
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
layout: "sumologic"
3+
page_title: "SumoLogic: sumologic_aws_xray_source"
4+
description: |-
5+
Provides a Sumologic AWS XRay source.
6+
---
7+
8+
# sumologic_aws_xray_source
9+
Provides a Sumologic AWS XRay source to collect metrics derived from XRay traces.
10+
11+
__IMPORTANT:__ The AWS credentials are stored in plain-text in the state. This is a potential security issue.
12+
13+
## Example Usage
14+
```hcl
15+
resource "sumologic_aws_xray_source" "terraform_aws_xray_source" {
16+
name = "AWS XRay Metrics"
17+
description = "My description"
18+
category = "aws/terraform_xray"
19+
content_type = "AwsXRay"
20+
scan_interval = 300000
21+
paused = false
22+
collector_id = "${sumologic_collector.collector.id}"
23+
24+
authentication {
25+
type = "AWSRoleBasedAuthentication"
26+
role_arn = "arn:aws:iam::01234567890:role/sumo-role"
27+
}
28+
29+
path {
30+
type = "AwsXRayPath"
31+
limit_to_regions = ["us-west-2"]
32+
}
33+
}
34+
35+
resource "sumologic_collector" "collector" {
36+
name = "my-collector"
37+
description = "Just testing this"
38+
}
39+
```
40+
41+
## Argument reference
42+
43+
In addition to the common properties, the following arguments are supported:
44+
45+
- `content_type` - (Required) The content-type of the collected data. This has to be `AwsXRay` for AWS XRay source.
46+
- `scan_interval` - (Required) Time interval in milliseconds of scans for new data. The minimum value is 1000 milliseconds. Currently this value is not respected, and collection happens at a default interval of 1 minute.
47+
- `paused` - (Required) When set to true, the scanner is paused. To disable, set to false.
48+
- `authentication` - (Required) Authentication details for making `xray:Get*` calls.
49+
+ `type` - (Required) Must be either `S3BucketAuthentication` or `AWSRoleBasedAuthentication`
50+
+ `access_key` - (Required) Your AWS access key if using type `S3BucketAuthentication`
51+
+ `secret_key` - (Required) Your AWS secret key if using type `S3BucketAuthentication`
52+
+ `role_arn` - (Required) Your AWS role ARN if using type `AWSRoleBasedAuthentication`
53+
- `path` - (Required) The location to scan for new data.
54+
+ `type` - (Required) type of polling source. This has to be `AwsXRayPath` for AWS XRay source.
55+
+ `limit_to_regions` - (Optional) List of Amazon regions.
56+
57+
### See also
58+
* [Common Source Properties](https://github.com/terraform-providers/terraform-provider-sumologic/tree/master/website#common-source-properties)
59+
60+
## Attributes Reference
61+
The following attributes are exported:
62+
63+
- `id` - The internal ID of the source.
64+
65+
## Import
66+
AWS XRay sources can be imported using the collector and source IDs (`collector/source`), e.g.:
67+
68+
```hcl
69+
terraform import sumologic_aws_xray_source.test 123/456
70+
```
71+
72+
AWS XRay sources can be imported using the collector name and source name (`collectorName/sourceName`), e.g.:
73+
74+
```hcl
75+
terraform import sumologic_aws_xray_source.test my-test-collector/my-test-source
76+
```

0 commit comments

Comments
 (0)