### Terraform statuspage_page_access_group Resource Example Source: https://github.com/sbecker59/terraform-provider-statuspage/blob/main/docs/resources/page_access_group.md This example demonstrates the creation of a statuspage_page_access_group resource. It depends on existing statuspage_component and statuspage_page_access_user resources, referencing their IDs to define the group's members and associated components. The resource requires a name and page_id, and optionally accepts lists of component and user IDs. ```terraform resource "statuspage_component" "my_component" { page_id = "my_page_id" name = "My Website" description = "Status of my Website" status = "operational" lifecycle { ignore_changes = [ status ] } } resource "statuspage_page_access_user" "my_user" { page_id = "my_page_id" email = "my_user@example.com" } resource "statuspage_page_access_group" "my_user_group" { page_id = "my_page_id" name = "My Page Access User Group" users = [ statuspage_page_access_user.my_user.id ] components = [ statuspage_component.my_component.id ] } ``` -------------------------------- ### statuspage_pages Data Source Example Source: https://github.com/sbecker59/terraform-provider-statuspage/blob/main/docs/data-sources/pages.md This Terraform configuration block demonstrates how to use the `statuspage_pages` data source to retrieve information about a specific status page. It requires the `page_name` to identify the target page and can optionally include filters for more granular retrieval. ```terraform data "statuspage_pages" "default" { page_name = local.page_name } ``` -------------------------------- ### Create statuspage_subscriber Resource Source: https://github.com/sbecker59/terraform-provider-statuspage/blob/main/docs/resources/subscriber.md Defines a Statuspage subscriber resource using Terraform. This example demonstrates how to create an email subscriber by providing the page ID and the subscriber's email address. ```terraform resource "statuspage_subscriber" "my_subscriber" { page_id = "my_page_id" email = "my_email@example.com" } ``` -------------------------------- ### statuspage_components Data Source Example - Terraform Source: https://github.com/sbecker59/terraform-provider-statuspage/blob/main/docs/data-sources/components.md This data source can be used to query components of a status page. It requires the `page_id` and can optionally filter components by name using a `filter` block. The output includes a list of `components` with their respective details. ```terraform data "statuspage_components" "default" { page_id = local.page_id filter { name = "name" values = [ "value_1", "value_2" ] } } ``` -------------------------------- ### Get Statuspage Component Groups Source: https://github.com/sbecker59/terraform-provider-statuspage/blob/main/docs/data-sources/component_groups.md This Terraform configuration retrieves component groups for a given Statuspage ID. It demonstrates how to use the `statuspage_component_groups` data source with a filter on the `name` attribute. This is useful for dynamically fetching component group information based on specific criteria. ```terraform data "statuspage_component_groups" "default" { page_id = local.page_id filter { name = "name" values = [ "value_1", "value_2" ] } } ``` -------------------------------- ### Import Existing Resources (Bash) Source: https://context7.com/sbecker59/terraform-provider-statuspage/llms.txt Demonstrates how to import existing StatusPage resources into Terraform state using the `terraform import` command. This is crucial for managing resources that were not initially created by Terraform. The import format typically follows `page-id/resource-id` and requires careful verification after import. ```bash # Import a component using page-id/component-id format terraform import statuspage_component.api_server abc123xyz/comp456def # Import a component group terraform import statuspage_component_group.backend_services abc123xyz/group789ghi # Import an incident terraform import statuspage_incident.outage abc123xyz/incident123abc # After import, verify the configuration matches terraform plan # Example workflow for importing multiple components #!/bin/bash PAGE_ID="abc123xyz" COMPONENT_IDS=("comp1" "comp2" "comp3") for comp_id in "${COMPONENT_IDS[@]}"; do resource_name=$(echo "$comp_id" | tr '[:upper:]' '[:lower:]') terraform import "statuspage_component.${resource_name}" "${PAGE_ID}/${comp_id}" done ``` -------------------------------- ### Query Components Data Source (HCL) Source: https://context7.com/sbecker59/terraform-provider-statuspage/llms.txt Retrieves existing StatusPage components using the `statuspage_components` data source. This is useful for referencing components in other resources, filtering them by name, or outputting their details. The `page_id` is required, and filters can be applied to narrow down the results. ```hcl # Fetch all components for a page data "statuspage_components" "all" { page_id = "abc123xyz" } # Filter components by name data "statuspage_components" "production_services" { page_id = "abc123xyz" filter { name = "name" values = ["API Server", "Database", "Web Application"] } } # Use component data in other resources output "component_details" { value = { for component in data.statuspage_components.all.components : component.name => { id = component.id description = component.description automation_email = component.automation_email group_id = component.group_id position = component.position } } } # Reference existing components resource "statuspage_incident" "example" { page_id = "abc123xyz" name = "Service Degradation" status = "identified" body = "Performance issues detected" component { id = data.statuspage_components.production_services.components[0].id name = data.statuspage_components.production_services.components[0].name status = "degraded_performance" } } ``` -------------------------------- ### Organize Components with Groups (HCL) Source: https://context7.com/sbecker59/terraform-provider-statuspage/llms.txt Defines and organizes StatusPage components into logical groups using the `statuspage_component` and `statuspage_component_group` resources. This allows for better management and visualization of related components on a StatusPage. Ensure the `page_id` is correct and component IDs are valid when referencing them in groups. ```hcl resource "statuspage_component" "api_gateway" { page_id = "abc123xyz" name = "API Gateway" status = "operational" } resource "statuspage_component" "auth_service" { page_id = "abc123xyz" name = "Authentication Service" status = "operational" } resource "statuspage_component" "payment_service" { page_id = "abc123xyz" name = "Payment Service" status = "operational" } resource "statuspage_component_group" "backend_services" { page_id = "abc123xyz" name = "Backend Services" description = "Core backend microservices" components = [ statuspage_component.api_gateway.id, statuspage_component.auth_service.id, statuspage_component.payment_service.id ] } # Multiple groups can be created to organize different service tiers resource "statuspage_component_group" "infrastructure" { page_id = "abc123xyz" name = "Infrastructure" description = "Core infrastructure components" components = [ statuspage_component.database.id, statuspage_component.cdn.id ] } ``` -------------------------------- ### Create and Manage StatusPage Components Source: https://context7.com/sbecker59/terraform-provider-statuspage/llms.txt Defines a StatusPage component, representing a service or system. It includes details like page ID, name, description, status, and visibility settings. The `lifecycle` block can ignore changes to specific attributes, such as status, to prevent Terraform from overriding manual or automated updates. ```hcl resource "statuspage_component" "api_server" { page_id = "abc123xyz" name = "API Server" description = "Main REST API endpoint for application services" status = "operational" showcase = true only_show_if_degraded = false # Ignore status changes made outside Terraform (e.g., via automation or manual updates) lifecycle { ignore_changes = [status] } } resource "statuspage_component" "database" { page_id = "abc123xyz" name = "PostgreSQL Database" description = "Primary production database cluster" status = "operational" start_date = "2024-01-01" } # Output the automation email for component status updates output "api_automation_email" { value = statuspage_component.api_server.automation_email description = "Email address for automated status updates" } # Valid status values: # - operational # - under_maintenance # - degraded_performance # - partial_outage # - major_outage ``` -------------------------------- ### Query Pages Data Source (HCL) Source: https://context7.com/sbecker59/terraform-provider-statuspage/llms.txt Retrieves StatusPage information using the `statuspage_pages` data source. This is useful for obtaining page IDs dynamically, which can then be used to configure other resources like components. Filtering by page name is supported. ```hcl # Fetch all accessible pages data "statuspage_pages" "my_pages" { filter { name = "name" values = ["Production Status"] } } # Use page data for dynamic configuration locals { page_id = data.statuspage_pages.my_pages.pages[0].id } resource "statuspage_component" "dynamic_component" { page_id = local.page_id name = "Dynamically Created Component" description = "Component created using data source page ID" status = "operational" } output "page_url" { value = data.statuspage_pages.my_pages.pages[0].url description = "Public URL for the status page" } ``` -------------------------------- ### Query Component Groups Data Source (HCL) Source: https://context7.com/sbecker59/terraform-provider-statuspage/llms.txt Retrieves existing StatusPage component groups using the `statuspage_component_groups` data source. This enables referencing and filtering of component groups for organizational purposes. The `page_id` is mandatory, and filters can be applied to select specific groups. ```hcl # Fetch all component groups data "statuspage_component_groups" "all_groups" { page_id = "abc123xyz" } # Filter groups by name data "statuspage_component_groups" "backend_groups" { page_id = "abc123xyz" filter { name = "name" values = ["Backend Services", "Infrastructure"] } } # Access group information output "group_info" { value = [ for group in data.statuspage_component_groups.all_groups.component_groups : { id = group.id name = group.name description = group.description components = group.components position = group.position } ] } ``` -------------------------------- ### Configure StatusPage Provider with API Key Source: https://context7.com/sbecker59/terraform-provider-statuspage/llms.txt Configures the StatusPage Terraform provider, specifying the required version and authentication credentials. The API key can be provided directly or via environment variables like STATUSPAGE_API_KEY or SP_API_KEY. ```hcl terraform { required_providers { statuspage = { source = "sbecker59/statuspage" version = "~> 1.0" } } } provider "statuspage" { api_key = "your-api-key-here" } # Alternative: Use environment variables # export STATUSPAGE_API_KEY="your-api-key-here" # or # export SP_API_KEY="your-api-key-here" provider "statuspage" { # api_key will be read from STATUSPAGE_API_KEY or SP_API_KEY environment variable } ``` -------------------------------- ### Create and Manage StatusPage Incidents Source: https://context7.com/sbecker59/terraform-provider-statuspage/llms.txt Defines a StatusPage incident, used to communicate outages or maintenance. It includes details like page ID, name, status, impact override, and a body describing the issue. Incidents can also associate specific component statuses, and scheduled maintenance incidents have additional options for automation. ```hcl resource "statuspage_component" "web_app" { page_id = "abc123xyz" name = "Web Application" description = "Primary web interface" status = "operational" } resource "statuspage_component" "cdn" { page_id = "abc123xyz" name = "CDN" description = "Content delivery network" status = "operational" } resource "statuspage_incident" "database_outage" { page_id = "abc123xyz" name = "Database Connection Issues" status = "investigating" impact_override = "major" body = "We are currently investigating reports of database connection timeouts affecting multiple services." component { id = statuspage_component.web_app.id name = statuspage_component.web_app.name status = "partial_outage" } component { id = statuspage_component.cdn.id name = statuspage_component.cdn.name status = "degraded_performance" } } # Scheduled maintenance example resource "statuspage_incident" "scheduled_maintenance" { page_id = "abc123xyz" name = "Database Upgrade Maintenance" status = "scheduled" impact_override = "maintenance" body = "We will be performing a database upgrade on Saturday at 2:00 AM UTC. Expected downtime: 2 hours." scheduled_remind_prior = true scheduled_auto_in_progress = true scheduled_auto_completed = true component { id = statuspage_component.web_app.id name = statuspage_component.web_app.name status = "under_maintenance" } } # Valid incident status values: # - investigating # - identified # - monitoring # - resolved # For scheduled: scheduled, in_progress, verifying, completed # Valid impact_override values: # - none # - minor # - major # - critical # - maintenance ``` -------------------------------- ### statuspage_component Resource Source: https://github.com/sbecker59/terraform-provider-statuspage/blob/main/docs/resources/component.md Manages a Statuspage Component. This resource creates and configures a component on your Statuspage, allowing you to track the status of a specific service or operational unit. ```APIDOC ## statuspage_component Resource ### Description Manages a Statuspage Component. This resource creates and configures a component on your Statuspage, allowing you to track the status of a specific service or operational unit. ### Method `POST` (Implicit - managed by Terraform) ### Endpoint `/pages/{page_id}/components` (Implicit - managed by Terraform) ### Parameters #### Path Parameters - `page_id` (String) - Required - The ID of the page this component belongs to. #### Query Parameters None #### Request Body - `name` (String) - Required - Display Name for the component. - `description` (String) - Optional - More detailed description for the component. - `only_show_if_degraded` (Boolean) - Optional. - `showcase` (Boolean) - Optional - Should this component be shown component only if in degraded state. - `start_date` (String) - Optional - Should this component be showcased. - `status` (String) - Optional - The current status of the component (e.g., "operational", "degraded", "maintenance", "major_outage"). ### Request Example ```terraform resource "statuspage_component" "my_component" { page_id = "my_page_id" name = "My Website" description = "Status of my Website" status = "operational" lifecycle { ignore_changes = [ status ] } } ``` ### Response #### Success Response (200) - `id` (String) - The ID of the created component. - `automation_email` (String) - The email address used for automating status updates for this component. #### Response Example ```json { "id": "generated_component_id", "page_id": "my_page_id", "name": "My Website", "description": "Status of my Website", "status": "operational", "automation_email": "component_id@example.statuspage.io" } ``` ``` -------------------------------- ### Create statuspage_component Resource Source: https://github.com/sbecker59/terraform-provider-statuspage/blob/main/docs/resources/component.md Defines a statuspage_component resource with essential properties like page_id, name, description, and status. It also includes lifecycle rules to ignore changes to the status attribute. ```terraform resource "statuspage_component" "my_component" { page_id = "my_page_id" name = "My Website" description = "Status of my Website" status = "operational" lifecycle { ignore_changes = [ status ] } } ``` -------------------------------- ### Create Statuspage User Access - Terraform Source: https://github.com/sbecker59/terraform-provider-statuspage/blob/main/docs/resources/page_access_user.md Defines a Statuspage.io user with access to a specific page. Requires a page ID and the user's email address. The resource automatically manages the user's ID upon creation. ```terraform resource "statuspage_page_access_user" "my_user" { page_id = "my_page_id" email = "my_user@example.com" } ``` -------------------------------- ### Create statuspage_component_group Resource Source: https://github.com/sbecker59/terraform-provider-statuspage/blob/main/docs/resources/component_group.md This Terraform code defines a component group resource for Statuspage. It requires the page ID, name, and a list of component IDs. An optional description can also be provided. ```terraform resource "statuspage_component_group" "my_group" { page_id = "my_page_id" name = "Terraform" description = "Created by terraform" components = [ statuspage_component.my_component.id ] } ``` -------------------------------- ### statuspage_pages Data Source Source: https://github.com/sbecker59/terraform-provider-statuspage/blob/main/docs/data-sources/pages.md Use the statuspage_pages data source to retrieve information about pages in Statuspage.io. This is useful for dynamically fetching page IDs or names based on filters. ```APIDOC ## statuspage_pages (Data Source) ### Description Provides details about Statuspage.io pages, allowing you to filter and retrieve specific page information based on criteria like page name. ### Method GET ### Endpoint /pages ### Parameters #### Query Parameters - **page_name** (String) - Required - The name of the page to retrieve. - **filter** (Block Set) - Optional - A block to filter the pages based on specific criteria. #### Nested Schema for `filter` - **name** (String) - Required - The name of the attribute to filter on. - **values** (List of String) - Required - A list of values to match for the given attribute. - **regex** (Boolean) - Optional - Whether to interpret the `values` as regular expressions. ### Request Example ```terraform data "statuspage_pages" "default" { page_name = local.page_name } ``` ### Response #### Success Response (200) - **id** (String) - The ID of the resource. - **page_name** (String) - The name of the page. #### Response Example ```json { "id": "some-page-id", "page_name": "Example Page" } ``` ``` -------------------------------- ### Create Statuspage Incident Resource Source: https://github.com/sbecker59/terraform-provider-statuspage/blob/main/docs/resources/incident.md This Terraform code defines and creates a statuspage_incident resource. It requires the page ID, incident name, status, and optionally a body and component overrides. The `component` block allows specifying which components are affected and their new status. ```terraform resource "statuspage_incident" "my_incident" { page_id = "my_page_id" name = "Incident name" impact_override = "none" status = "investigating" body = "We are currently investigating the issue." component { id = statuspage_component.my_component.id name = statuspage_component.my_component.name status = "under_maintenance" } component { id = statuspage_component.my_component_2.id name = statuspage_component.my_component_2.name status = "under_maintenance" } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.