Skip to content

Commit 4242aee

Browse files
chore: add changelog, update readme (#76)
1 parent 7b12d40 commit 4242aee

File tree

2 files changed

+112
-68
lines changed

2 files changed

+112
-68
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## 0.1.0 - 2025-06-17
2+
3+
- First release
4+
- Add support for the following resource types:
5+
* `stacklet_account`
6+
* `stacklet_account_discovery_aws`
7+
* `stacklet_account_discovery_azure`
8+
* `stacklet_account_discovery_gcp`
9+
* `stacklet_account_group`
10+
* `stacklet_account_group_mapping`
11+
* `stacklet_binding`
12+
* `stacklet_policy_collection`
13+
* `stacklet_policy_collection_mapping`
14+
* `stacklet_repository`
15+
- Add support for the following data source types:
16+
* `stacklet_account`
17+
* `stacklet_account_group`
18+
* `stacklet_binding`
19+
* `stacklet_policy`
20+
* `stacklet_policy_collection`
21+
* `stacklet_repository`

README.md

Lines changed: 91 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,12 @@
11
# Terraform Provider for Stacklet
22

3-
This Terraform Provider allows you to interact with Stacklet's GraphQL API to manage your resources through Infrastructure as Code.
3+
This Terraform Provider allows you to interact with Stacklet's GraphQL API to
4+
manage your resources through Infrastructure as Code.
45

5-
## Requirements
6-
7-
- [Terraform](https://www.terraform.io/downloads.html) >= 1.11
8-
- [Go](https://golang.org/doc/install) >= 1.24.2
9-
10-
## Building The Provider
11-
12-
1. Clone the repository:
13-
```bash
14-
git clone https://github.com/stacklet/terraform-provider-stacklet.git
15-
cd terraform-provider-stacklet
16-
```
17-
18-
2. Build the provider:
19-
```bash
20-
just build
21-
```
226

237
## Using the provider
248

25-
### Local Development
26-
27-
When developing locally, you can use the provider by configuring Terraform to use your local build:
28-
29-
1. Override the provider location for development, by creating a `~/.terraformrc` with the following content:
30-
31-
```terraform
32-
provider_installation {
33-
dev_overrides {
34-
"stacklet/stacklet" = "<absolute path to the repository directory>"
35-
}
36-
37-
# For all other providers, install them directly from their origin provider
38-
# registries as normal. If you omit this, Terraform will _only_ use the
39-
# dev_overrides block, and so no other providers will be available.
40-
direct {}
41-
}
42-
```
43-
44-
2. Declare the provider in the terraform file
9+
The provider is configured as follows:
4510

4611
```terraform
4712
terraform {
@@ -53,45 +18,30 @@ terraform {
5318
}
5419
5520
provider "stacklet" {
56-
endpoint = "https://api.<myinstance>.stacklet.io/" # Or use STACKLET_ENDPOINT env var
57-
api_key = "your-api-key" # Or use STACKLET_API_KEY env var
21+
endpoint = "https://api.<INSTANCE_NAME>.stacklet.io/"
22+
api_key = "<API_KEY>"
5823
}
5924
```
6025

61-
3. Run `terraform plan` or `terraform apply` with the local resources configuration.
62-
63-
64-
**Note**: `terraform init` must not be run when working with a locally installed provider.
65-
66-
67-
#### Debugging the provider
68-
69-
Debug messages and output are not visible when running the provider directly from terraform.
70-
To enable debug
26+
### Environment variables
7127

72-
1. run `./terraform-provider-stacklet -debug`
73-
74-
2. export the `TF_REATTACH_PROVIDERS` variable provided in the output in the shell where `terraform` is run
75-
76-
77-
### Environment Variables
78-
79-
The provider can be configured using environment variables:
28+
As an alternative, endpoint and key can be defined as environment variables:
8029

8130
```bash
82-
export STACKLET_ENDPOINT="https://api.<myinstance>.stacklet.io/"
83-
export STACKLET_API_KEY="your-api-key"
31+
export STACKLET_ENDPOINT="https://api.<INSTANCE_NAME>.stacklet.io/"
32+
export STACKLET_API_KEY="<API_KEY>"
8433
```
8534

86-
### Login via stacklet-admin CLI
87-
88-
The provider can look up authentication details from the [`stacklet-admin`](https://github.com/stacklet/stacklet-admin) CLI.
35+
### Login via `stacklet-admin` CLI
8936

90-
After configuring and logging in to the instance via the CLI (`stacklet-admin login`), the provider will be able to connect
91-
to it.
37+
The provider can also look up authentication details from the
38+
[`stacklet-admin`](https://github.com/stacklet/stacklet-admin) CLI.
9239

40+
After configuring and logging in to the instance via the CLI (`stacklet-admin
41+
login`), the provider will be able to connect to it without needing to specify
42+
credentials in the configuration or via environment variables.
9343

94-
### Example Terraform
44+
### Example configuration
9545

9646
Below is a full example of a configuration to create a few resources in Stacklet.
9747

@@ -105,8 +55,8 @@ terraform {
10555
}
10656
10757
provider "stacklet" {
108-
endpoint = "https://api.<myinstance>.stacklet.io/"
109-
api_key = "$api_key_here"
58+
endpoint = "https://api.<INSTANCE_NAME>.stacklet.io/"
59+
api_key = "<API_KEY>"
11060
}
11161
11262
data "stacklet_policy_collection" "example" {
@@ -167,3 +117,76 @@ data "stacklet_binding" "binding" {
167117
name = "AWS Posture"
168118
}
169119
```
120+
121+
122+
## Local development
123+
124+
For local development, make sure you have the tools declared in the
125+
[`.tool-versions`](./.tool-versions) file installed.
126+
127+
### Building the provider
128+
129+
1. Clone the repository:
130+
```bash
131+
git clone https://github.com/stacklet/terraform-provider-stacklet.git
132+
cd terraform-provider-stacklet
133+
```
134+
135+
2. Build the provider:
136+
```bash
137+
just build
138+
```
139+
140+
### Running locally built provider
141+
142+
To run the locally built copy of the provider, terraform must be configured as
143+
follows:
144+
145+
1. Override the provider location for development, by creating a
146+
`~/.terraformrc` with the following content:
147+
148+
```terraform
149+
provider_installation {
150+
dev_overrides {
151+
"stacklet/stacklet" = "<absolute path to the repository directory>"
152+
}
153+
154+
# For all other providers, install them directly from their origin provider
155+
# registries as normal. If you omit this, Terraform will _only_ use the
156+
# dev_overrides block, and so no other providers will be available.
157+
direct {}
158+
}
159+
```
160+
161+
2. Declare the provider in your terraform configuration as
162+
163+
```terraform
164+
terraform {
165+
required_providers {
166+
stacklet = {
167+
source = "stacklet/stacklet"
168+
}
169+
}
170+
}
171+
172+
provider "stacklet" {
173+
endpoint = "https://api.<INSTANCE_NAME>.stacklet.io/" # Or set STACKLET_ENDPOINT env var
174+
api_key = "<API_KEY>" # Or set STACKLET_API_KEY env var
175+
}
176+
```
177+
178+
3. Run `terraform plan` or `terraform apply` with the local resources configuration.
179+
180+
181+
**Note**: `terraform init` must not be run when working with a locally installed provider.
182+
183+
### Debugging
184+
185+
Debug messages and output are not visible when running the provider directly
186+
from terraform. To enable debug:
187+
188+
1. Run `./terraform-provider-stacklet -debug` in one terminal.
189+
190+
2. In a separate terminal, export the value for the `TF_REATTACH_PROVIDERS`
191+
variable provided in the output of the previous command, and run
192+
`terraform`.

0 commit comments

Comments
 (0)