Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The [examples diretory](./examples) contains example configuration for the vario

### Build the provider from source

The build requires [Go](https://golang.org/doc/install) >= 1.23
The build requires [Go](https://golang.org/doc/install) >= 1.24

In order to develop and test this provider, you'll need to configure your local environment
with a custom Terraform [config file](https://developer.hashicorp.com/terraform/cli/config/config-file).
Expand Down
56 changes: 56 additions & 0 deletions docs/data-sources/pcu_group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "astra_pcu_group Data Source - terraform-provider-astra"
subcategory: ""
description: |-
Retrieves details for a specific PCU (Provisioned Capacity Units) group by its ID.
---

# astra_pcu_group (Data Source)

Retrieves details for a specific PCU (Provisioned Capacity Units) group by its ID.

## Example Usage

```terraform
data "astra_pcu_group" "example" {
pcu_group_id = "6c57916e-7bd8-4bb6-b264-bae906c8859f"
}

output "pcu_group_info" {
value = {
title = data.astra_pcu_group.example.title
cloud_provider = data.astra_pcu_group.example.cloud_provider
region = data.astra_pcu_group.example.region
min_capacity = data.astra_pcu_group.example.min_capacity
max_capacity = data.astra_pcu_group.example.max_capacity
status = data.astra_pcu_group.example.status
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `pcu_group_id` (String) The unique identifier of the PCU group to retrieve.

### Read-Only

- `cache_type` (String) The instance type/cache type for the PCU group.
- `cloud_provider` (String) The cloud provider where the PCU group is provisioned (e.g., AWS, GCP, AZURE).
- `created_at` (String) Timestamp when the PCU group was created.
- `created_by` (String) The user who created the PCU group.
- `description` (String) The user-defined description of the PCU group.
- `id` (String) The unique identifier of the PCU group.
- `max_capacity` (Number) The maximum capacity units the PCU group may scale to.
- `min_capacity` (Number) The minimum capacity units the PCU must be scaled to.
- `org_id` (String) The organization ID that owns this PCU group.
- `provision_type` (String) The provisioning type for the PCU group (i.e., SHARED, DEDICATED).
- `region` (String) The cloud region where the PCU group is provisioned.
- `reserved_capacity` (Number) The reserved (committed) capacity units for the PCU group.
- `status` (String) The current status of the PCU group (e.g., ACTIVE, CREATED, INITIALIZING).
- `title` (String) The user-defined title/name of the PCU group.
- `updated_at` (String) Timestamp when the PCU group was last updated.
- `updated_by` (String) The user who last updated the PCU group.
46 changes: 46 additions & 0 deletions docs/data-sources/pcu_group_associations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "astra_pcu_group_associations Data Source - terraform-provider-astra"
subcategory: ""
description: |-
Gets all of the associations for a given PCU group.
---

# astra_pcu_group_associations (Data Source)

Gets all of the associations for a given PCU group.

## Example Usage

```terraform
data "astra_pcu_group" "pcu_group" {
# ...
}

data "astra_pcu_group_associations" "assocs" {
pcu_group_id = data.astra_pcu_group.pcu_group.id
}

output "datacenters" {
value = data.astra_pcu_group_associations.assocs.results[*].datacenter_id
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `pcu_group_id` (String) The PCU group to retrieve associations for.

### Read-Only

- `results` (Attributes List) (see [below for nested schema](#nestedatt--results))

<a id="nestedatt--results"></a>
### Nested Schema for `results`

Read-Only:

- `datacenter_id` (String) The datacenter that is associated with the PCU Group.
- `provisioning_status` (String) The provisioning status of the PCU group association. This will likely always be 'CREATED'.
75 changes: 75 additions & 0 deletions docs/data-sources/pcu_groups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "astra_pcu_groups Data Source - terraform-provider-astra"
subcategory: ""
description: |-
Retrieves a list of PCU (Provisioned Capacity Units) groups. If no IDs are specified, returns all PCU groups in the organization.
---

# astra_pcu_groups (Data Source)

Retrieves a list of PCU (Provisioned Capacity Units) groups. If no IDs are specified, returns all PCU groups in the organization.

## Example Usage

```terraform
# Get all PCU groups in the organization
data "astra_pcu_groups" "all" {
}

output "all_pcu_groups" {
value = data.astra_pcu_groups.all.results[*].title
}

# Get specific PCU groups by ID
data "astra_pcu_groups" "specific" {
pcu_group_ids = [
"6c57916e-7bd8-4bb6-b264-bae906c8859f",
"7d68027f-8ce9-5cc7-c375-cbf017d9960g"
]
}

output "specific_pcu_groups" {
value = {
for group in data.astra_pcu_groups.specific.results : group.id => {
title = group.title
cloud_provider = group.cloud_provider
region = group.region
status = group.status
}
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `pcu_group_ids` (List of String) Optional list of PCU group IDs to retrieve. If not provided, all PCU groups in the organization will be returned.

### Read-Only

- `results` (Attributes List) The list of PCU groups matching the specified criteria or all PCU groups if no IDs were provided. (see [below for nested schema](#nestedatt--results))

<a id="nestedatt--results"></a>
### Nested Schema for `results`

Read-Only:

- `cache_type` (String) The instance type/cache type for the PCU group.
- `cloud_provider` (String) The cloud provider where the PCU group is provisioned (e.g., AWS, GCP, AZURE).
- `created_at` (String) Timestamp when the PCU group was created.
- `created_by` (String) The user who created the PCU group.
- `description` (String) The user-defined description of the PCU group.
- `id` (String) The unique identifier of the PCU group.
- `max_capacity` (Number) The maximum capacity units the PCU group may scale to.
- `min_capacity` (Number) The minimum capacity units the PCU must be scaled to.
- `org_id` (String) The organization ID that owns this PCU group.
- `provision_type` (String) The provisioning type for the PCU group (i.e., SHARED, DEDICATED).
- `region` (String) The cloud region where the PCU group is provisioned.
- `reserved_capacity` (Number) The reserved (committed) capacity units for the PCU group.
- `status` (String) The current status of the PCU group (e.g., ACTIVE, CREATED, INITIALIZING).
- `title` (String) The user-defined title/name of the PCU group.
- `updated_at` (String) Timestamp when the PCU group was last updated.
- `updated_by` (String) The user who last updated the PCU group.
44 changes: 44 additions & 0 deletions docs/functions/resolve_datacenter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "resolve_datacenter function - terraform-provider-astra"
subcategory: ""
description: |-

---

# function: resolve_datacenter

Resolves the datacenter ID for a given database and optional region (if the database has multiple regions). Helpful for components that require a datacenter ID such as PCU group associations and private links.

## Example Usage

```terraform
data "astra_database" "example_db" {
# ...
}

locals {
# If the database has multiple regions, you can specify the desired one explicitly
dc_id1 = provider::astra::resolve_datacenter(data.astra_database.example_db, "us-central1")

# Or, if the database has only one region, you can omit the second argument
dc_id2 = provider::astra::resolve_datacenter(data.astra_database.example_db)

# This is all shorthand for the following much longer expression:
dc_id3 = data.astra_database.example_db.datacenters["${data.astra_database.example_db.cloud_provider}.${data.astra_database.example_db.regions[0]}"]
}
```

## Signature

<!-- signature generated by tfplugindocs -->
```text
resolve_datacenter(database object, region string...) string
```

## Arguments

<!-- arguments generated by tfplugindocs -->
1. `database` (Object) The database object to resolve the datacenter from. This should be the result of an "astra_database" resource or data source.
<!-- variadic argument generated by tfplugindocs -->
1. `region` (Variadic, String) The region to resolve the datacenter for. If not provided, the function will attempt to resolve the datacenter if there is only one configured.
105 changes: 105 additions & 0 deletions docs/resources/pcu_group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "astra_pcu_group Resource - terraform-provider-astra"
subcategory: ""
description: |-
Creates and manages a PCU (Provisioned Capacity Units) group. PCU groups provide dedicated compute capacity for databases in a specific cloud provider and region.
---

# astra_pcu_group (Resource)

Creates and manages a PCU (Provisioned Capacity Units) group. PCU groups provide dedicated compute capacity for databases in a specific cloud provider and region.

## Example Usage

```terraform
# Create a basic PCU group
# NOTE: This creates a committed reserved-capacity group! Make sure this is what you want!
resource "astra_pcu_group" "example" {
title = "production-pcu-group"
cloud_provider = "AWS"
region = "us-east-1"
min_capacity = 2
max_capacity = 10
reserved_capacity = 2
description = "PCU group for production databases"
# You can uncomment the line below to park the group
# The group must be created first as a resource before parking can be performed successfully
# parked = true
}

# Create a PCU group with custom settings
resource "astra_pcu_group" "custom" {
title = "dev-pcu-group"
cloud_provider = "GCP"
region = "us-central1"
cache_type = "STANDARD"
provision_type = "SHARED"
min_capacity = 1
max_capacity = 5
description = "PCU group for development environment"

# Disable deletion protection for dev environment
deletion_protection = false

# Enable reserved capacity protection
reserved_protection = true
}

output "pcu_group_id" {
value = astra_pcu_group.example.id
}

output "pcu_group_status" {
value = astra_pcu_group.example.status
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `cloud_provider` (String) The cloud provider where the PCU group will be provisioned (e.g., AWS, GCP, AZURE). This cannot be changed after creation.
- `max_capacity` (Number) The maximum capacity units the PCU group may scale to. Must be at least 1 and greater than or equal to min_capacity.
- `min_capacity` (Number) The minimum capacity units the PCU must be scaled to. Must be at least 1 and greater than or equal to reserved_capacity.
- `region` (String) The cloud region where the PCU group will be provisioned. This cannot be changed after creation.
- `title` (String) The user-defined title/name of the PCU group.

### Optional

- `cache_type` (String) The instance type/cache type for the PCU group. Defaults to 'STANDARD'. Changing this value requires replacement.
- `deletion_protection` (Boolean) When enabled, prevents accidental deletion of the PCU group. Defaults to true.
- `description` (String) A user-defined description for the PCU group.
- `park` (Boolean) When set to true, parks the PCU group and any associated databases, reducing costs. When set to false, unparks the group. Defaults to false.
- `provision_type` (String) The provisioning type for the PCU group (e.g., SHARED, DEDICATED). Defaults to 'SHARED'. Changing this value requires replacement.
- `reserved_capacity` (Number) The reserved (committed) capacity units for the PCU group. Must be at least 0. Changing this value when reserved_protection is enabled will result in an error.
- `reserved_protection` (Boolean) When enabled, prevents accidental reserved capacity unit increases. Defaults to true.
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-Only

- `created_at` (String) Timestamp when the PCU group was created.
- `created_by` (String) The user who created the PCU group.
- `id` (String) The unique identifier of the PCU group.
- `org_id` (String) The organization ID that owns this PCU group.
- `status` (String) The current status of the PCU group (e.g., ACTIVE, PARKED, CREATING, TERMINATING).
- `updated_at` (String) Timestamp when the PCU group was last updated.
- `updated_by` (String) The user who last updated the PCU group.

<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`

Optional:

- `create` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
- `update` (String) A string that can be [parsed as a duration](https://pkg.go.dev/time#ParseDuration) consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

## Import

Import is supported using the following syntax:

```shell
# Import an existing PCU group by its ID
terraform import astra_pcu_group.example 6c57916e-7bd8-4bb6-b264-bae906c8859f
```
Loading
Loading