Skip to content
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

GH-790: Improve logstream resource schema #798

Merged
merged 3 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/resources/log_stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ Optional:

- `aws_account_id` (String) The AWS Account ID.
- `aws_partner_event_source` (String) Name of the Partner Event Source to be used with AWS. Generally generated by Auth0 and passed to AWS, so this should be an output attribute.
- `aws_region` (String) The AWS Region, e.g. "us-east-2").
- `aws_region` (String) The region in which the EventBridge event source will be created. Possible values: `ap-east-1`, `ap-northeast-1`, `ap-northeast-2`, `ap-northeast-3`, `ap-south-1`, `ap-southeast-1`, `ap-southeast-2`, `ca-central-1`, `cn-north-1`, `cn-northwest-1`, `eu-central-1`, `eu-north-1`, `eu-west-1`, `eu-west-2`, `eu-west-3`, `me-south-1`, `sa-east-1`, `us-gov-east-1`, `us-gov-west-1`, `us-east-1`, `us-east-2`, `us-west-1`, `us-west-2`.
- `azure_partner_topic` (String) Name of the Partner Topic to be used with Azure. Generally should not be specified.
- `azure_region` (String) The Azure region code, e.g. "ne")
- `azure_region` (String) The Azure region code. Possible values: `australiacentral`, `australiaeast`, `australiasoutheast`, `brazilsouth`, `canadacentral`, `canadaeast`, `centralindia`, `centralus`, `eastasia`, `eastus`, `eastus2`, `francecentral`, `germanywestcentral`, `japaneast`, `japanwest`, `koreacentral`, `koreasouth`, `northcentralus`, `northeurope`, `norwayeast`, `southafricanorth`, `southcentralus`, `southeastasia`, `southindia`, `switzerlandnorth`, `uaenorth`, `uksouth`, `ukwest`, `westcentralus`, `westeurope`, `westindia`, `westus`, `westus2`.
- `azure_resource_group` (String) The Azure EventGrid resource group which allows you to manage all Azure assets within one subscription.
- `azure_subscription_id` (String) The unique alphanumeric string that identifies your Azure subscription.
- `datadog_api_key` (String, Sensitive) The Datadog API key.
- `datadog_region` (String) The Datadog region. Options are ["us", "eu", "us3", "us5"].
- `datadog_region` (String) The Datadog region. Possible values: `us`, `eu`, `us3`, `us5`.
- `http_authorization` (String, Sensitive) Sent in the HTTP "Authorization" header with each request.
- `http_content_format` (String) The format of data sent over HTTP. Options are "JSONLINES", "JSONARRAY" or "JSONOBJECT"
- `http_content_type` (String) The "Content-Type" header to send over HTTP. Common value is "application/json".
Expand Down
110 changes: 90 additions & 20 deletions internal/auth0/logstream/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,41 @@ func NewResource() *schema.Resource {
Description: "The AWS Account ID.",
},
"aws_region": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
"ap-east-1",
"ap-northeast-1",
"ap-northeast-2",
"ap-northeast-3",
"ap-south-1",
"ap-southeast-1",
"ap-southeast-2",
"ca-central-1",
"cn-north-1",
"cn-northwest-1",
"eu-central-1",
"eu-north-1",
"eu-west-1",
"eu-west-2",
"eu-west-3",
"me-south-1",
"sa-east-1",
"us-gov-east-1",
"us-gov-west-1",
"us-east-1",
"us-east-2",
"us-west-1",
"us-west-2",
}, false),
RequiredWith: []string{"sink.0.aws_account_id"},
Description: "The AWS Region, e.g. \"us-east-2\").",
Description: "The region in which the EventBridge event source will be created. " +
"Possible values: `ap-east-1`, `ap-northeast-1`, `ap-northeast-2`, `ap-northeast-3`, " +
"`ap-south-1`, `ap-southeast-1`, `ap-southeast-2`, `ca-central-1`, `cn-north-1`, " +
"`cn-northwest-1`, `eu-central-1`, `eu-north-1`, `eu-west-1`, `eu-west-2`, `eu-west-3`, " +
"`me-south-1`, `sa-east-1`, `us-gov-east-1`, `us-gov-west-1`, `us-east-1`, `us-east-2`, " +
"`us-west-1`, `us-west-2`.",
},
"aws_partner_event_source": {
Type: schema.TypeString,
Expand All @@ -122,11 +152,52 @@ func NewResource() *schema.Resource {
"Azure assets within one subscription.",
},
"azure_region": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringInSlice([]string{
"australiacentral",
"australiaeast",
"australiasoutheast",
"brazilsouth",
"canadacentral",
"canadaeast",
"centralindia",
"centralus",
"eastasia",
"eastus",
"eastus2",
"francecentral",
"germanywestcentral",
"japaneast",
"japanwest",
"koreacentral",
"koreasouth",
"northcentralus",
"northeurope",
"norwayeast",
"southafricanorth",
"southcentralus",
"southeastasia",
"southindia",
"switzerlandnorth",
"uaenorth",
"uksouth",
"ukwest",
"westcentralus",
"westeurope",
"westindia",
"westus",
"westus2",
}, false),
RequiredWith: []string{"sink.0.azure_subscription_id", "sink.0.azure_resource_group"},
Description: "The Azure region code, e.g. \"ne\")",
Description: "The Azure region code. Possible values: `australiacentral`, `australiaeast`, " +
"`australiasoutheast`, `brazilsouth`, `canadacentral`, `canadaeast`, `centralindia`, " +
"`centralus`, `eastasia`, `eastus`, `eastus2`, `francecentral`, " +
"`germanywestcentral`, `japaneast`, `japanwest`, `koreacentral`, `koreasouth`, " +
"`northcentralus`, `northeurope`, `norwayeast`, `southafricanorth`, `southcentralus`, " +
"`southeastasia`, `southindia`, `switzerlandnorth`, `uaenorth`, `uksouth`, `ukwest`, " +
"`westcentralus`, `westeurope`, `westindia`, `westus`, `westus2`.",
},
"azure_partner_topic": {
Type: schema.TypeString,
Expand All @@ -136,9 +207,8 @@ func NewResource() *schema.Resource {
"Generally should not be specified.",
},
"http_content_format": {
Type: schema.TypeString,
Optional: true,
RequiredWith: []string{"sink.0.http_endpoint", "sink.0.http_authorization", "sink.0.http_content_type"},
Type: schema.TypeString,
Optional: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May need to be computed too?

Description: "The format of data sent over HTTP. Options are " +
"\"JSONLINES\", \"JSONARRAY\" or \"JSONOBJECT\"",
ValidateFunc: validation.StringInSlice([]string{
Expand All @@ -152,26 +222,26 @@ func NewResource() *schema.Resource {
Optional: true,
Description: "The \"Content-Type\" header to send over HTTP. " +
"Common value is \"application/json\".",
RequiredWith: []string{"sink.0.http_endpoint", "sink.0.http_authorization", "sink.0.http_content_format"},
},
"http_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.IsURLWithHTTPS,
Description: "The HTTP endpoint to send streaming logs.",
RequiredWith: []string{"sink.0.http_content_format", "sink.0.http_authorization", "sink.0.http_content_type"},
},
"http_authorization": {
Type: schema.TypeString,
Optional: true,
Sensitive: true,
Description: "Sent in the HTTP \"Authorization\" header with each request.",
RequiredWith: []string{"sink.0.http_content_format", "sink.0.http_endpoint", "sink.0.http_content_type"},
Type: schema.TypeString,
Optional: true,
Sensitive: true,
Description: "Sent in the HTTP \"Authorization\" header with each request.",
},
"http_custom_headers": {
Type: schema.TypeList,
Elem: &schema.Schema{
Type: schema.TypeMap,
Elem: &schema.Schema{Type: schema.TypeString},
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
Optional: true,
Default: nil,
Expand All @@ -185,7 +255,7 @@ func NewResource() *schema.Resource {
[]string{"us", "eu", "us3", "us5"},
false,
),
Description: "The Datadog region. Options are [\"us\", \"eu\", \"us3\", \"us5\"].",
Description: "The Datadog region. Possible values: `us`, `eu`, `us3`, `us5`.",
},
"datadog_api_key": {
Type: schema.TypeString,
Expand Down