Skip to content

Commit 2b4baa2

Browse files
committed
Improve README on provider usage
1 parent 84a8291 commit 2b4baa2

File tree

1 file changed

+93
-1
lines changed

1 file changed

+93
-1
lines changed

README.md

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,99 @@ go install
1717

1818
## Using the provider
1919

20-
Fill this in for each provider
20+
The Catalyst provider enables you to manage Diagrid Catalyst resources using Terraform. You'll need an API key to authenticate with the Catalyst API.
21+
22+
### Provider Configuration
23+
24+
```hcl
25+
terraform {
26+
required_providers {
27+
catalyst = {
28+
source = "diagridio/catalyst"
29+
}
30+
}
31+
}
32+
33+
provider "catalyst" {
34+
api_key = var.api_key
35+
endpoint = var.endpoint # Optional, defaults to production endpoint
36+
}
37+
```
38+
39+
### Authentication
40+
41+
Set your API key as a variable or environment variable:
42+
43+
```bash
44+
export TF_VAR_api_key="your-catalyst-api-key"
45+
```
46+
47+
### Available Resources
48+
49+
#### Regions
50+
Create and manage Catalyst regions:
51+
52+
```hcl
53+
resource "catalyst_region" "us_west" {
54+
name = "us-west-region"
55+
ingress = "https://*.example.com:443"
56+
host = "us-west-host"
57+
location = "us-west-1"
58+
}
59+
```
60+
61+
#### Projects
62+
Create projects within regions:
63+
64+
```hcl
65+
resource "catalyst_project" "my_project" {
66+
region = catalyst_region.us_west.name
67+
name = "my-application"
68+
}
69+
```
70+
71+
#### Service Accounts
72+
Manage service accounts for programmatic access:
73+
74+
```hcl
75+
resource "catalyst_service_account" "automation" {
76+
name = "automation-account"
77+
description = "Service account for CI/CD automation"
78+
owner = "devops@example.com"
79+
role = "cra.diagrid:admin" # or "cra.diagrid:viewer"
80+
}
81+
```
82+
83+
#### Service Account API Keys
84+
Generate API keys for service accounts:
85+
86+
```hcl
87+
resource "catalyst_service_account_api_key" "automation_key" {
88+
name = "automation-api-key"
89+
service_account_id = catalyst_service_account.automation.name
90+
expire_in_seconds = 86400 # 24 hours (optional)
91+
}
92+
93+
# Access the generated token
94+
output "api_key_token" {
95+
value = catalyst_service_account_api_key.automation_key.token
96+
sensitive = true
97+
}
98+
```
99+
100+
### Available Data Sources
101+
102+
All resources are also available as data sources for referencing existing infrastructure:
103+
104+
- `data.catalyst_organization` - Organization information
105+
- `data.catalyst_region` - Region details
106+
- `data.catalyst_project` - Project information
107+
- `data.catalyst_service_account` - Service account details
108+
- `data.catalyst_service_account_api_key` - API key information
109+
110+
### Example Usage
111+
112+
See the `examples/` directory for complete working examples of each resource type.
21113

22114
## Developing the Provider
23115

0 commit comments

Comments
 (0)