Skip to content

Commit

Permalink
Add support for Scalyr log integration (#147)
Browse files Browse the repository at this point in the history
Extends the log integration resource to support Scalyr.

Close #146
  • Loading branch information
tbroden84 authored Apr 6, 2022
1 parent 056aec6 commit e2fa777
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
21 changes: 19 additions & 2 deletions cloudamqp/resource_cloudamqp_integration_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func resourceIntegrationLog() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Sensitive: true,
Description: "The token used for authentication. (Loggly, Logentries, Splunk)",
Description: "The token used for authentication. (Loggly, Logentries, Splunk, Scalyr)",
},
"region": {
Type: schema.TypeString,
Expand Down Expand Up @@ -92,6 +92,12 @@ func resourceIntegrationLog() *schema.Resource {
Optional: true,
Description: "The client email. (Stackdriver)",
},
"host": {
Type: schema.TypeString,
Optional: true,
Description: "The host information. (Scalyr)",
ValidateFunc: validateIntegrationLogScalyrHost(),
},
},
}
}
Expand Down Expand Up @@ -180,6 +186,14 @@ func validateIntegrationLogName() schema.SchemaValidateFunc {
"cloudwatchlog",
"datadog",
"stackdriver",
"scalyr",
}, true)
}

func validateIntegrationLogScalyrHost() schema.SchemaValidateFunc {
return validation.StringInSlice([]string{
"app.scalyr.com",
"app.eu.scalyr.com",
}, true)
}

Expand All @@ -195,7 +209,8 @@ func validateIntegrationLogsSchemaAttribute(key string) bool {
"tags",
"project_id",
"private_key",
"client_email":
"client_email",
"host":
return true
}
return false
Expand All @@ -217,6 +232,8 @@ func integrationLogKeys(intName string) []string {
return []string{"region", "api_key", "tags"}
case "stackdriver":
return []string{"project_id", "private_key", "client_email"}
case "scalyr":
return []string{"token", "host"}
default:
return []string{"url", "host_port", "token", "region", "access_key_id", "secret_access_key"}
}
Expand Down
10 changes: 10 additions & 0 deletions docs/resources/integration_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ resource "cloudamqp_integration_log" "stackdriver" {
private_key = var.stackdriver_private_key
client_email = var.stackdriver_client_email
}
resource "cloudamqp_integration_log" "scalyr" {
instance_id = cloudamqp_instance.instance.id
name = "scalyr"
token = var.scalyr_token
host = var.scalyr_host
}
```

## Argument Reference
Expand All @@ -80,6 +87,7 @@ The following arguments are supported:
* `project_id` - (Optional) The project identifier.
* `private_key` - (Optional) The private access key.
* `client_email` - (Optional) The client email registered for the integration service.
* `host` - (Optional) The host for Scalyr integration. (app.scalyr.com, app.eu.scalyr.com)

This is the full list of all arguments. Only a subset of arguments are used based on which type of integration used. See [Integration Type reference](#integration-type-reference) table below for more information.

Expand All @@ -106,6 +114,7 @@ Valid names for third party log integration.
| splunk | Create a HTTP Event Collector token at https://.cloud.splunk.com/en-US/manager/search/http-eventcollector |
| datadog | Create a Datadog API key at app.datadoghq.com |
| stackdriver | Create a service account and add 'monitor metrics writer' role, then download credentials. |
| scalyr | Create a Log write token at https://app.scalyr.com/keys |

## Integration Type reference

Expand All @@ -122,6 +131,7 @@ Required arguments for all integrations: name
| Splunk | splunk | token, host_port |
| Data Dog | datadog | region, api_keys, tags |
| Stackdriver | stackdriver | project_id, private_key, client_email |
| Scalyr | scalyr | token, host |

## Attributes Reference

Expand Down

0 comments on commit e2fa777

Please sign in to comment.