### Example Usage Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/data_enrichments.md Examples demonstrating how to use the coralogix_data_enrichments data source to import existing enrichments by ID. ```APIDOC ## Example Usage ```terraform data "coralogix_data_enrichments" "imported_enrichment" { id = "geo_ip,sus_ip" } data "coralogix_data_enrichments" "imported_enrichment" { id = "12345" // a custom enrichments id } ``` ``` -------------------------------- ### Build and Install Coralogix Provider Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/CONTRIBUTING.md Navigate to the provider directory and build the provider using 'make install'. Adjust the OS_ARCH in the Makefile if necessary. ```bash $ cd $GOPATH/src/github.com/hashicorp/terraform-provider-coralogix $ make install ``` -------------------------------- ### Example Usage of Coralogix IP Access Data Source Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/ip_access.md This example demonstrates how to configure the Coralogix provider and use the `coralogix_ip_access` data source to fetch IP access settings. Ensure your Coralogix API key and environment are set via environment variables or directly in the provider configuration. ```terraform terraform { required_providers { coralogix = { version = "~> 3.0" source = "coralogix/coralogix" } } } provider "coralogix" { #api_key = "" #env = "" } data "coralogix_ip_access" "ip_access" {} ``` -------------------------------- ### Initialize Terraform Configuration with Local Provider Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/CONTRIBUTING.md Initialize Terraform in an example directory. Ensure the provider source is set to 'locally/debug/coralogix' and the version matches the Makefile. ```bash $ cd examples/rules_group $ terraform init ``` -------------------------------- ### Retrieve Connector by Name Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/connector.md Use this example to fetch a connector's details using its name. ```APIDOC ## Data Source: coralogix_connector ### Description Coralogix Connector. **Note:** This resource is in Beta stage. ### Example Usage ```terraform data "coralogix_connector" "generic_https_example_data_by_name" { name = "" } ``` ### Schema ### Optional - `name` (String) Connector name. ### Read-Only - `config_overrides` (Attributes List) - `connector_config` (Attributes) - `description` (String) - `type` (String) Connector type. Valid values are: [email generic_https pagerduty service_now slack unspecified] ### Nested Schema for `config_overrides` Read-Only: - `entity_type` (String) Entity type for the connector. Valid values are: [alerts cases test_notifications unspecified] - `fields` (Attributes Set) ### Nested Schema for `config_overrides.fields` Read-Only: - `field_name` (String) - `template` (String) ### Nested Schema for `connector_config` Read-Only: - `fields` (Attributes Set) ### Nested Schema for `connector_config.fields` Read-Only: - `field_name` (String) - `value` (String) ``` -------------------------------- ### Example Usage of coralogix_archive_retentions Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/archive_retentions.md This example demonstrates how to configure the `coralogix_archive_retentions` resource in Terraform. It includes the necessary provider configuration and defines a list of retentions, with the first one being the default. ```terraform terraform { required_providers { coralogix = { version = "~> 3.0" source = "coralogix/coralogix" } } } provider "coralogix" { #api_key = "" #env = "" } resource "coralogix_archive_retentions" "example" { retentions = [ { }, { name = "name_2" }, { name = "name_3" }, { name = "name_4" }, ] } ``` -------------------------------- ### AWS Resource Catalog Integration Example Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/integration.md Configures a coralogix_integration resource for the aws-resource-catalog. This example demonstrates setting the IntegrationName and AwsRoleArn parameters. ```terraform resource "coralogix_integration" "aws-resource-catalog" { integration_key = "aws-resource-catalog" version = "0.1.0" parameters = { IntegrationName = "aws-resource-catalog" AwsRoleArn = "arn:aws:iam::123456789012:role/S3Access" } } ``` -------------------------------- ### Coralogix Global Router Resource Example Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/alert.md Sets up a global router for alerts, defining rules to direct alerts based on conditions to specific connectors and presets. ```terraform resource "coralogix_global_router" "example" { name = "global router example" description = "global router example" rules = [ { entity_type = "alerts" name = "rule-name" condition = "alertDef.priority == \"P1\"" targets = [ { connector_id = coralogix_connector.slack_example.id preset_id = coralogix_preset.slack_example.id } ] } ] } ``` -------------------------------- ### Common Makefile Commands for Coralogix Provider Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/CLAUDE.md Provides essential commands for building, installing, testing, and generating documentation for the Coralogix Terraform provider. ```bash make build # Compile the provider binary make install # Build and install into ~/.terraform.d/plugins/locally/debug/coralogix/1.5/ make test # Unit tests (parallel, 30s timeout) make testacc # Acceptance tests (TF_ACC=1, 120m timeout) — hits real Coralogix APIs make generate # Regenerate docs/ via terraform-plugin-docs (note: `git checkout -- docs/guides` runs after) ``` -------------------------------- ### Example Usage of coralogix_archive_logs Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/archive_logs.md This snippet shows how to configure the coralogix_archive_logs resource, including setting up the Terraform provider and defining the required bucket name. ```terraform terraform { required_providers { coralogix = { version = "~> 3.0" source = "coralogix/coralogix" } } } provider "coralogix" { #api_key = "" #env = "" } resource "coralogix_archive_logs" "example" { bucket = "" } ``` -------------------------------- ### Create a Global Router Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/global_router.md Example of how to define and configure a `coralogix_global_router` resource. This includes setting up routing labels and rules for directing traffic. ```terraform terraform { required_providers { coralogix = { version = "~> 3.0" source = "coralogix/coralogix" } } } resource "coralogix_global_router" "example" { # id = "router_default" # specify your own or leave blank for custom routers. router_default refers to the "global" router name = "global router example" description = "global router example" routing_labels = { environment = "production" service = "checkout" team = "commerce-platform" } rules = [{ entity_type = "alerts" name = "rule-name" condition = "alertDef.priority == \"P1\"" targets = [{ connector_id = "" preset_id = "" }] } ] } ``` -------------------------------- ### Skill File Layout Example Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/CLAUDE.md This is the standard markdown structure for a skill file, including frontmatter for metadata and sections for trigger, fix, and rationale. ```markdown --- name: description: --- # **Trigger:** <when this applies, in one line> **Fix:** <what to do — code snippet if useful> **Why:** <one sentence — the underlying reason, so future-you can judge edge cases> ``` -------------------------------- ### Provider Version Prompt Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/guides/alerts-migration-guide.md Example of the interactive prompt for specifying the Terraform provider version for migration. A default value is provided if no input is given. ```plaintext Enter the Terraform provider version to migrate to (e.g., ~>1.19.0): >=2.0.0 ``` -------------------------------- ### Create a Slack Preset Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/preset.md Configure a Slack preset for alerts. This example customizes the title and description fields using alert and alert definition variables. ```terraform resource "coralogix_preset" "slack_example" { id = "slack_example" name = "slack example" description = "slack preset example" entity_type = "alerts" connector_type = "slack" parent_id = "preset_system_slack_alerts_basic" config_overrides = [ { condition_type = { match_entity_type_and_sub_type = { entity_sub_type = "logsImmediateResolved" } } message_config = { fields = [ { field_name = "title" template = "{{alert.status}} {{alertDef.priority}} - {{alertDef.name}}" }, { field_name = "description" template = "{{alertDef.description}}" } ] } } ] } ``` -------------------------------- ### Create an Email Preset Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/preset.md Configure an email preset for alerts. This example customizes the subject and content fields, specifying 'email_default' as the payload type. ```terraform resource "coralogix_preset" "email_example" { id = "email_example" name = "email example" description = "email preset example" entity_type = "alerts" connector_type = "email" parent_id = "preset_system_email_alerts" config_overrides = [ { payload_type = "email_default" condition_type = { match_entity_type = {} } message_config = { fields = [ { field_name = "customSubject" template = "{{ alertDef.name }}" }, { field_name = "customContent" template = "<div>content-example</div>" } ] } } ] } ``` -------------------------------- ### Example Usage of coralogix_integration Data Source Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/integration.md Use this data source to retrieve an existing Coralogix integration by its ID. Ensure the integration ID is correctly referenced. ```terraform data "coralogix_integration" "data_example" { id = coralogix_integration.example.id } ``` -------------------------------- ### Terraform Plugin Development Override Configuration Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/CLAUDE.md Example of a `~/.terraformrc` dev-overrides block to point Terraform to a locally built provider version, typically used with `make install`. ```hcl provider_override { provider_ பதிப்பு = "coralogix" filesystem_paths = ["~/.terraform.d/plugins/locally/debug/coralogix"] } ``` -------------------------------- ### coralogix_archive_retentions Resource Example Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/archive_retentions.md Example of how to define and configure the coralogix_archive_retentions resource in Terraform, including setting up multiple retention policies. ```APIDOC ## coralogix_archive_retentions Resource ### Description Manages Coralogix archive retention policies. This resource allows the configuration of multiple retention policies, with the first one being a default that cannot be renamed. ### Schema #### Required - `retentions` (Attributes List) List of 4 retentions. The first retention is the default retention and can't be renamed. (see [below for nested schema](#nestedatt--retentions)) #### Read-Only - `id` (String) The ID of this resource. <a id="nestedatt--retentions"></a> ### Nested Schema for `retentions` Optional: - `name` (String) The retention name. If not set, the retention will be named by backend. Read-Only: - `editable` (Boolean) Is the retention editable. - `id` (String) The retention id. - `order` (Number) The retention order. Computed by the order of the retention in the retentions list definition. ### Example Usage ```terraform terraform { required_providers { coralogix = { version = "~> 3.0" source = "coralogix/coralogix" } } } provider "coralogix" { #api_key = "<add your api key here or add env variable CORALOGIX_API_KEY>" #env = "<add the environment you want to work at or add env variable CORALOGIX_ENV>" } resource "coralogix_archive_retentions" "example" { retentions = [ { }, { name = "name_2" }, { name = "name_3" }, { name = "name_4" }, ] } ``` ``` -------------------------------- ### coralogix_rules_group Data Source Example Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/rules_group.md An example of how to use the coralogix_rules_group data source to import an existing rules group by its ID. ```APIDOC ## coralogix_rules_group (Data Source) ### Description Provides information about an existing Coralogix rules group. ### Example Usage ```terraform data "coralogix_rules_group" "imported_rules_group_example" { id = coralogix_rules_group.rules_group_example.id } ``` ### Schema #### Read-Only Attributes - `active` (Boolean) - Determines whether the rule-group will be active. - `applications` (Set of String) - Rules will execute on logs that match the following applications. - `creator` (String) - Rule-group creator. - `description` (String) - Rule-group description. - `hidden` (Boolean) - Indicates if the rule-group is hidden. - `id` (String) - The ID of this resource. - `name` (String) - Rule-group name. - `order` (Number) - Determines the index of the rule-group between the other rule-groups. By default, will be added last. (1 based indexing). - `rule_subgroups` (List of Object) - List of rule-subgroups. Every rule-subgroup is a list of rules linked with a logical 'OR' (||) operation. - `active` (Boolean) - Indicates if the subgroup is active. - `id` (String) - The ID of the rule subgroup. - `order` (Number) - The order of the subgroup. - `rules` (List of Object) - List of rules within the subgroup. - `block` (List of Object) - Configuration for blocking logs. - `active` (Boolean) - Indicates if the block rule is active. - `blocking_all_matching_blocks` (Boolean) - If true, all matching blocks will be blocked. - `description` (String) - Description of the block rule. - `id` (String) - The ID of the block rule. - `keep_blocked_logs` (Boolean) - If true, blocked logs will be kept. - `name` (String) - Name of the block rule. - `order` (Number) - The order of the block rule. - `regular_expression` (String) - The regular expression to match logs. - `source_field` (String) - The field to apply the regular expression on. - `extract` (List of Object) - Configuration for extracting data from logs. - `active` (Boolean) - Indicates if the extract rule is active. - `description` (String) - Description of the extract rule. - `id` (String) - The ID of the extract rule. - `name` (String) - Name of the extract rule. - `order` (Number) - The order of the extract rule. - `regular_expression` (String) - The regular expression to extract data. - `source_field` (String) - The field to extract data from. - `extract_timestamp` (List of Object) - Configuration for extracting timestamp from logs. - `active` (Boolean) - Indicates if the extract timestamp rule is active. - `description` (String) - Description of the extract timestamp rule. - `field_format_standard` (String) - The standard format of the timestamp field. - `id` (String) - The ID of the extract timestamp rule. - `name` (String) - Name of the extract timestamp rule. - `order` (Number) - The order of the extract timestamp rule. - `source_field` (String) - The field containing the timestamp. - `time_format` (String) - The format of the timestamp. - `json_extract` (List of Object) - Configuration for extracting JSON data from logs. - `active` (Boolean) - Indicates if the JSON extract rule is active. - `description` (String) - Description of the JSON extract rule. - `destination_field` (String) - The field to store the extracted JSON value. - `destination_field_text` (String) - The text to store the extracted JSON value. - `id` (String) - The ID of the JSON extract rule. - `json_key` (String) - The JSON key to extract. - `name` (String) - Name of the JSON extract rule. - `order` (Number) - The order of the JSON extract rule. - `json_stringify` (List of Object) - Configuration for stringifying JSON data in logs. - `active` (Boolean) - Indicates if the JSON stringify rule is active. - `description` (String) - Description of the JSON stringify rule. - `destination_field` (String) - The field to store the stringified JSON. - `id` (String) - The ID of the JSON stringify rule. - `keep_source_field` (Boolean) - If true, the source field will be kept. - `name` (String) - Name of the JSON stringify rule. - `order` (Number) - The order of the JSON stringify rule. - `source_field` (String) - The field containing the JSON to stringify. - `parse` (List of Object) - Configuration for parsing logs. - `active` (Boolean) - Indicates if the parse rule is active. - `description` (String) - Description of the parse rule. - `destination_field` (String) - The field to store the parsed data. - `id` (String) - The ID of the parse rule. - `name` (String) - Name of the parse rule. - `order` (Number) - The order of the parse rule. - `regular_expression` (String) - The regular expression to parse logs. - `source_field` (String) - The field to parse. - `parse_json_field` (List of Object) - Configuration for parsing a JSON field in logs. - `active` (Boolean) - Indicates if the parse JSON field rule is active. - `description` (String) - Description of the parse JSON field rule. - `destination_field` (String) - The field to store the parsed JSON field. - `id` (String) - The ID of the parse JSON field rule. - `name` (String) - Name of the parse JSON field rule. - `order` (Number) - The order of the parse JSON field rule. - `source_field` (String) - The field containing the JSON to parse. - `remove_fields` (List of Object) - Configuration for removing fields from logs. - `active` (Boolean) - Indicates if the remove fields rule is active. - `description` (String) - Description of the remove fields rule. - `id` (String) - The ID of the remove fields rule. - `name` (String) - Name of the remove fields rule. - `order` (Number) - The order of the remove fields rule. - `source_field` (String) - The field to remove. - `replace` (List of Object) - Configuration for replacing values in logs. - `active` (Boolean) - Indicates if the replace rule is active. - `description` (String) - Description of the replace rule. - `id` (String) - The ID of the replace rule. - `name` (String) - Name of the replace rule. - `order` (Number) - The order of the replace rule. - `regular_expression` (String) - The regular expression to find values to replace. - `source_field` (String) - The field to perform replacements on. - `severities` (Set of String) - Rules will execute on logs that match the these severities. Can be one of ["Critical" "Debug" "Error" "Info" "Verbose" "Warning"]. - `subsystems` (Set of String) - Rules will execute on logs that match the following subsystems. ``` -------------------------------- ### Run Acceptance Tests Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/CONTRIBUTING.md Execute the full suite of acceptance tests using 'make testacc'. Be aware that these tests create real resources. ```bash $ make testacc ``` -------------------------------- ### Configure Coralogix SLO V2 (Window-Based) Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/slo_v2.md This example shows how to define a window-based SLO. It specifies the SLO's name, description, target threshold, labels, SLI (using a query, window, comparison operator, and threshold), and time window. This is useful for metrics that are measured over a specific time interval. ```terraform resource "coralogix_slo_v2" "example_window_based_slo" { name = "coralogix_window_based_slo" description = "Example SLO using window-based metrics" target_threshold_percentage = 95 labels = { env = "prod" service = "api" } sli = { window_based_metric_sli = { query = { query = "avg(avg_over_time(request_duration_seconds[1m]))" } window = "1_minute" comparison_operator = "less_than" threshold = 0.232 } } window = { slo_time_frame = "28_days" } } ``` -------------------------------- ### coralogix_preset Resource Examples Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/preset.md This snippet demonstrates how to use the coralogix_preset resource to configure different types of presets, including generic_https, slack, pagerduty, and email connectors. It shows the required arguments and optional configuration overrides. ```APIDOC ## coralogix_preset (Resource) Coralogix Preset. **NOTE:** This resource is in Beta stage. ### Example Usage ```terraform terraform { required_providers { coralogix = { version = "~> 3.0" source = "coralogix/coralogix" } } } provider "coralogix" { #api_key = "<add your api key here or add env variable CORALOGIX_API_KEY>" #env = "<add the environment you want to work at or add env variable CORALOGIX_ENV>" } resource "coralogix_preset" "generic_https_example" { id = "generic_https_example" name = "generic_https example" description = "generic_https preset example" entity_type = "alerts" connector_type = "generic_https" parent_id = "preset_system_generic_https_alerts_empty" config_overrides = [ { condition_type = { match_entity_type_and_sub_type = { entity_sub_type = "logsImmediateResolved" } } message_config = { fields = [ { field_name = "headers" template = "{}" }, { field_name = "body" template = "{ \"groupingKey\": \"{{alert.groupingKey}}\", \"status\": \"{{alert.status}}\", \"groups\": \"{{alert.groups}}\" }" } ] } } ] } resource "coralogix_preset" "slack_example" { id = "slack_example" name = "slack example" description = "slack preset example" entity_type = "alerts" connector_type = "slack" parent_id = "preset_system_slack_alerts_basic" config_overrides = [ { condition_type = { match_entity_type_and_sub_type = { entity_sub_type = "logsImmediateResolved" } } message_config = { fields = [ { field_name = "title" template = "{{alert.status}} {{alertDef.priority}} - {{alertDef.name}}" }, { field_name = "description" template = "{{alertDef.description}}" } ] } } ] } resource "coralogix_preset" "pagerduty_example" { id = "pagerduty_example" name = "pagerduty example" description = "pagerduty preset example" entity_type = "alerts" connector_type = "pagerduty" parent_id = "preset_system_pagerduty_alerts_basic" config_overrides = [ { condition_type = { match_entity_type = { } } message_config = { fields = [ { field_name = "summary" template = "{{ alertDef.description }}" }, { field_name = "severity" template = <<EOF {% if alert.highestPriority | default(value = alertDef.priority) == 'P1' %} critical {% elif alert.highestPriority | default(value = alertDef.priority) == 'P2' %} error {% elif alert.highestPriority | default(value = alertDef.priority) == 'P3' %} warning {% elif alert.highestPriority | default(value = alertDef.priority) == 'P4' or alert.highestPriority | default(value = alertDef.priority) == 'P5' %} info {% else %} info {% endif %} EOF }, { field_name = "timestamp" template = "{{ alert.timestamp }}" } ] } } ] } resource "coralogix_preset" "email_example" { id = "email_example" name = "email example" description = "email preset example" entity_type = "alerts" connector_type = "email" parent_id = "preset_system_email_alerts" config_overrides = [ { payload_type = "email_default" condition_type = { match_entity_type = {} } message_config = { fields = [ { field_name = "customSubject" template = "{{ alertDef.name }}" }, { field_name = "customContent" template = "<div>content-example</div>" } ] } } ] } ``` ## Schema ### Required - `connector_type` (String) The type of connector for the preset. Valid values are: email, generic_https, pagerduty, service_now, slack, unspecified - `entity_type` (String) The type of entity for the preset. Valid values are: alerts, cases, test_notifications, unspecified - `name` (String) - `parent_id` (String) ``` -------------------------------- ### Recurring suppression with meta_labels selector Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/alerts_scheduler.md Set up recurring alert suppression rules, for example, weekly suppression every Sunday. This example uses `meta_labels` to further refine which alerts are suppressed. ```terraform resource "coralogix_alerts_scheduler" "recurring_suppression" { name = "Weekly Maintenance Window" description = "Suppress alerts every Sunday for maintenance" filter = { what_expression = "source logs | filter true" meta_labels = [ { key = "team" value = "platform" } ] } schedule = { operation = "mute" recurring = { dynamic = { repeat_every = 1 frequency = { weekly = { days = ["Sunday"] } } time_frame = { start_time = "2025-01-05T02:00:00.000" duration = { for_over = 4 frequency = "hours" } time_zone = "UTC+0" } termination_date = "2026-01-01T00:00:00.000" } } } } ``` -------------------------------- ### Migration Type Selection Prompt Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/guides/alerts-migration-guide.md Example output showing the interactive prompt for choosing the migration type. Users can select to migrate based on a folder containing a terraform.tfstate file or a specific resource type. ```plaintext [INFO] Select the migration type: [INFO] 1) Migrate based on a folder containing terraform.tfstate [INFO] 2) Migrate based on a specific resource name Enter your choice (1 or 2): 2 ``` -------------------------------- ### Apply Terraform Configuration Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/CONTRIBUTING.md Create or update infrastructure resources by running 'terraform apply -auto-approve'. Use with caution. ```bash $ terraform apply -auto-approve ``` -------------------------------- ### coralogix_ip_access Resource Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/ip_access.md Example of how to configure the coralogix_ip_access resource to manage IP access settings. ```APIDOC ## coralogix_ip_access (Resource) ### Description Manages Coralogix IP Access settings. ### Schema #### Optional - `enable_coralogix_customer_support_access` (String) - Controls whether Coralogix customer support can access your account. - `ip_access` (Attributes Set) - A set of IP access rules. #### Nested Schema for `ip_access`: ##### Required - `enabled` (Boolean) - Whether this IP access entry is enabled. - `ip_range` (String) - The IP range in CIDR notation. ##### Optional - `name` (String) - The name of the IP access entry. #### Read-Only - `id` (String) - The unique identifier for the company IP access settings. This is typically a company ID. ### Example Usage ```terraform resource "coralogix_ip_access" "ip_access" { enable_coralogix_customer_support_access = "enabled" ip_access = [ { enabled = true, ip_range = "100.64.0.0/10", name = "random range from wikipedia" } ] } ``` ``` -------------------------------- ### Create a Jira Webhook Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/webhook.md Sets up a webhook to send alert information to Jira. Requires Jira API token, email, project key, and the Jira instance URL. ```terraform resource "coralogix_webhook" "jira_webhook" { name = "jira-webhook" jira = { api_token = "api-token" email = "example@coralogix.com" project_key = "project-key" url = "https://coralogix.atlassian.net/jira/your-work" } } ``` -------------------------------- ### coralogix_archive_logs Resource Configuration Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/archive_logs.md Example of how to configure the coralogix_archive_logs resource in Terraform, including required and optional parameters. ```APIDOC ## coralogix_archive_logs (Resource) ### Description This resource configures the archiving of logs to a specified bucket. ### Schema #### Required - `bucket` (String) - The bucket name to store the archived logs in. #### Optional - `active` (Boolean) - Whether archiving is active. - `region` (String) - The bucket region. Refer to AWS documentation for valid regions. #### Read-Only - `archiving_format_id` (String) - The ID of the archiving format. - `enable_tags` (Boolean) - Indicates if tags are enabled for archiving. - `id` (String) - The unique identifier for this resource. ``` -------------------------------- ### coralogix_ip_access Data Source Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/ip_access.md Example usage of the coralogix_ip_access data source to fetch IP access settings. ```APIDOC ## coralogix_ip_access (Data Source) ### Description This data source retrieves the IP access settings for the Coralogix account. ### Schema #### Optional - `id` (String) - The unique identifier for the company IP access settings. This is typically a company ID. #### Read-Only - `enable_coralogix_customer_support_access` (String) - Indicates if Coralogix customer support access is enabled. - `ip_access` (Attributes Set) - A set of IP access entries. ##### Nested Schema for `ip_access` Read-Only: - `enabled` (Boolean) - Whether this IP access entry is enabled. - `ip_range` (String) - The IP range in CIDR notation. - `name` (String) - The name of the IP access entry. ### Example Usage ```terraform terraform { required_providers { coralogix = { version = "~> 3.0" source = "coralogix/coralogix" } } } provider "coralogix" { #api_key = "<add your api key here or add env variable CORALOGIX_API_KEY>" #env = "<add the environment you want to work at or add env variable CORALOGIX_ENV>" } data "coralogix_ip_access" "ip_access" {} ``` ``` -------------------------------- ### Example Usage of Global Router Data Source Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/global_router.md Demonstrates how to fetch a GlobalRouter by its ID or by its name. Ensure you replace the placeholder values with your actual GlobalRouter ID or name. ```terraform data "coralogix_global_router" "example_data" { id = "<global_router_id>" } data "coralogix_global_router" "example_data_by_name" { name = "<global_router_name>" } ``` -------------------------------- ### Retrieve Connector by ID Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/connector.md Use this example to fetch a connector's details using its unique ID. ```APIDOC ## Data Source: coralogix_connector ### Description Coralogix Connector. **Note:** This resource is in Beta stage. ### Example Usage ```terraform data "coralogix_connector" "generic_https_example_data" { id = "<connector_id>" } ``` ### Schema ### Optional - `id` (String) Connector ID. Can be set by the user or generated by Coralogix. Requires recreation in case of change. ### Read-Only - `config_overrides` (Attributes List) - `connector_config` (Attributes) - `description` (String) - `type` (String) Connector type. Valid values are: [email generic_https pagerduty service_now slack unspecified] <a id="nestedatt--config_overrides"> ### Nested Schema for `config_overrides` Read-Only: - `entity_type` (String) Entity type for the connector. Valid values are: [alerts cases test_notifications unspecified] - `fields` (Attributes Set) <a id="nestedatt--config_overrides--fields"> ### Nested Schema for `config_overrides.fields` Read-Only: - `field_name` (String) - `template` (String) <a id="nestedatt--connector_config"> ### Nested Schema for `connector_config` Read-Only: - `fields` (Attributes Set) <a id="nestedatt--connector_config--fields"> ### Nested Schema for `connector_config.fields` Read-Only: - `field_name` (String) - `value` (String) ``` -------------------------------- ### Basic coralogix_action Resource Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/action.md This example demonstrates how to configure a basic `coralogix_action` resource. It sets the action to be private, targets 'Log' source types, and defines a Google search URL that uses a placeholder for selected values. Ensure your Terraform configuration includes the Coralogix provider and specifies the required version. ```terraform terraform { required_providers { coralogix = { version = "~> 3.0" source = "coralogix/coralogix" } } } provider "coralogix" { #api_key = "<add your api key here or add env variable CORALOGIX_API_KEY>" #env = "<add the environment you want to work at or add env variable CORALOGIX_ENV>" } resource "coralogix_action" "action" { is_private = false source_type = "Log" name = "google search action" url = "https://www.google.com/search?q={{$p.selected_value}}" } ``` -------------------------------- ### coralogix_hosted_dashboard Data Source Usage Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/hosted_dashboard.md Example of how to use the coralogix_hosted_dashboard data source to import an existing dashboard by its UID. ```APIDOC ## coralogix_hosted_dashboard (Data Source) ### Description Provides information about a Coralogix hosted dashboard. ### Schema #### Required - `uid` (String) The unique identifier of a dashboard with the dashboard-type prefix (e.g. - grafana:vgvvfknr) #### Read-Only - `grafana` (List of Object) Hosted grafana dashboard. * [Official documentation](https://grafana.com/docs/grafana/latest/dashboards/) * [HTTP API](https://grafana.com/docs/grafana/latest/http_api/dashboard/) (see [below for nested schema](#nestedatt--grafana)) - `id` (String) The ID of this resource. <a id="nestedatt--grafana"></a> ### Nested Schema for `grafana` Read-Only: - `config_json` (String) - `dashboard_id` (Number) - `folder` (Number) - `is_starred` (Boolean) - `title` (String) - `uid` (String) - `url` (String) - `version` (Number) ### Example Usage ```terraform data "coralogix_hosted_dashboard" "imported_dashboard" { uid = coralogix_hosted_dashboard.dashboard.id } ``` ``` -------------------------------- ### Script Execution Logs Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/guides/alerts-migration-guide.md Example log output during the migration script execution, showing steps like creating migration folders, generating import files, initializing Terraform, and applying configurations. ```plaintext 2024-12-01 15:45:22 [INFO] Creating migration folder: ./alert_migration 2024-12-01 15:45:22 [INFO] Running generate_imports.go with -type... 2024-12-01 15:45:22 [INFO] Successfully generated imports.tf at ./alert_migration. 2024-12-01 15:45:22 [INFO] Generating provider configuration in ./alert_migration/provider.tf... 2024-12-01 15:45:22 [INFO] Provider configuration generated in ./alert_migration/provider.tf. 2024-12-01 15:45:22 [INFO] Initializing Terraform in ./alert_migration... 2024-12-01 15:45:22 [INFO] Running terraform plan in ./alert_migration... ... 2024-12-01 15:45:22 [INFO] Terraform apply completed. 2024-12-01 15:45:22 [INFO] Cleanup completed. 2024-12-01 15:45:22 [INFO] Script completed successfully. ``` -------------------------------- ### coralogix_global_router Data Source Usage Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/global_router.md Example usage of the coralogix_global_router data source to retrieve a GlobalRouter by its ID or name. ```APIDOC ## coralogix_global_router (Data Source) Coralogix GlobalRouter. **Note:** This resource is in Beta stage. ### Example Usage ```terraform data "coralogix_global_router" "example_data" { id = "<global_router_id>" } data "coralogix_global_router" "example_data_by_name" { name = "<global_router_name>" } ``` ### Schema #### Optional - `id` (String) The ID of the GlobalRouter. Use `router_default` for the default; leave empty for auto generated or provide your own (unique) id. - `name` (String) Name of the GlobalRouter. #### Read-Only - `description` (String) Description of the GlobalRouter. - `entity_labels` (Map of String) - `fallback` (Attributes List) Fallback routing targets. (see [below for nested schema](#nestedatt--fallback)) - `routing_labels` (Attributes) Routers other than `router_default` require at least one of the properties to be set. Note that these values are globally unique. Labels matching is linked with AND, so an alert has to have all labels specified below. (see [below for nested schema](#nestedatt--routing_labels)) - `rules` (Attributes List) Routing rules for the GlobalRouter. (see [below for nested schema](#nestedatt--rules)) <a id="nestedatt--fallback"></a> ### Nested Schema for `fallback` Read-Only: - `connector_id` (String) ID of the connector. - `custom_details` (Map of String) Custom details for the target. - `preset_id` (String) ID of the preset. <a id="nestedatt--routing_labels"></a> ### Nested Schema for `routing_labels` Read-Only: - `environment` (String) - `service` (String) - `team` (String) <a id="nestedatt--rules"></a> ### Nested Schema for `rules` Read-Only: - `condition` (String) - `custom_details` (Map of String) Custom details for the rule. - `entity_type` (String) - `name` (String) Name of the routing rule. - `targets` (Attributes List) Routing targets for the rule. (see [below for nested schema](#nestedatt--rules--targets)) <a id="nestedatt--rules--targets"></a> ### Nested Schema for `rules.targets` Read-Only: - `connector_id` (String) ID of the connector. - `custom_details` (Map of String) Custom details for the target. - `preset_id` (String) ID of the preset. ``` -------------------------------- ### coralogix_dashboards_folder Data Source Usage Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/dashboards_folder.md Example usage of the coralogix_dashboards_folder data source to fetch folder information by name or ID. ```APIDOC ## coralogix_dashboards_folder (Data Source) ### Description Provides information about a Coralogix dashboards folder. ### Example Usage ```terraform data "coralogix_dashboards_folder" "example_by_name" { name = "example" } data "coralogix_dashboards_folder" "example_by_id" { id = "ccd6b9c7-223c-4ee6-8a1e-49da7112670d" } ``` ### Schema #### Optional - **id** (String) Unique identifier for the folder. - **name** (String) Display name of the folder. #### Read-Only - **parent_id** (String) Parent folder id. ``` -------------------------------- ### Create a Coralogix Scope Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/scope.md This example demonstrates how to create a `coralogix_scope` resource. It includes the necessary Terraform and provider configuration, along with defining a scope with a display name, default expression, and specific filters for logs. ```terraform terraform { required_providers { coralogix = { version = "~> 3.0" source = "coralogix/coralogix" } } } provider "coralogix" { #api_key = "<add your api key here or add env variable CORALOGIX_API_KEY>" #env = "<add the environment you want to work at or add env variable CORALOGIX_ENV>" } resource "coralogix_scope" "example" { display_name = "ExampleScope" default_expression = "<v1>true" filters = [ { entity_type = "logs" expression = "<v1>(subsystemName == 'purchases') || (subsystemName == 'signups')" } ] } ``` -------------------------------- ### coralogix_custom_role Data Source Usage Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/custom_role.md Examples of how to use the coralogix_custom_role data source to import custom roles by ID or by name. ```APIDOC ## coralogix_custom_role Data Source ### Description Coralogix Custom Role. ### Example Usage ```terraform data "coralogix_custom_role" "imported_by_id" { id = coralogix_custom_role.example.id } data "coralogix_custom_role" "imported_by_name" { name = coralogix_custom_role.example.name } ``` ### Schema #### Optional - `id` (String) Custom Role ID. - `name` (String) Custom Role name. #### Read-Only - `description` (String) Custom Role description. - `parent_role` (String) Parent role name - `permissions` (Set of String) Custom role permissions ``` -------------------------------- ### Get coralogix_scope Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/data-sources/scope.md Use the `coralogix_scope` data source to retrieve the ID of an existing scope. This is useful for referencing scopes in other resources. ```terraform data "coralogix_scope" "data_example" { id = coralogix_scope.example.id } ``` -------------------------------- ### Configure Auto-Refresh for Coralogix Dashboard Source: https://github.com/coralogix/terraform-provider-coralogix/blob/master/docs/resources/dashboard.md Set up automatic dashboard refreshing at a specified interval. This example configures a two-minute refresh rate. ```terraform auto_refresh = { type = "two_minutes" } ```