Skip to content

Commit eb82b36

Browse files
committed
add examples, update readme
1 parent 7e59960 commit eb82b36

File tree

7 files changed

+160
-10
lines changed

7 files changed

+160
-10
lines changed

README.md

+4-9
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ provider "astronomer" {
5353
3. Run the following commands to apply the provider:
5454
```shell
5555
export ASTRO_API_TOKEN=<token>
56-
terraform apply
5756
terraform plan
57+
terraform apply
5858
```
5959

6060
## Developing the Provider
@@ -63,16 +63,16 @@ If you wish to work on the provider, you'll first need [Go](http://www.golang.or
6363

6464
To compile the provider, see [Building The Provider](## Building The Provider).
6565

66-
To add example docs, add the correspond `.tf` files to the `examples` directory.
66+
To add example docs, add the correspond `.tf` files to the `examples` directory. These should be added for every new data source and resource.
6767

6868
To run terraform with the provider, create a `.terraformrc` file in your home directory (`~`) with the following content to override the provider installation with the local build:
6969

7070
```hcl
7171
provider_installation {
7272
dev_overrides {
73-
"registry.terraform.io/astronomer/astronomer" = "~/astronomer/astronomer-terraform-provider/bin" # Path to the provider binary
73+
"registry.terraform.io/astronomer/astronomer" = "~/astronomer-terraform-provider/bin" # Your path to the provider binary
7474
}
75-
direct {}
75+
direct {}
7676
}
7777
```
7878

@@ -86,14 +86,9 @@ terraform {
8686
}
8787
}
8888
89-
variable "token" {
90-
type = string
91-
}
92-
9389
provider "astronomer" {
9490
organization_id = "<cuid>"
9591
host = "https://api.astronomer-dev.io"
96-
token = var.token
9792
}
9893
9994
data "astronomer_workspace" "example" {

docs/data-sources/organization.md

+4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ description: |-
1010

1111
Organization data source
1212

13+
## Example Usage
1314

15+
```terraform
16+
data "astronomer_organization" "example" {}
17+
```
1418

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

docs/resources/deployment.md

+76-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,82 @@ description: |-
1010

1111
Deployment resource
1212

13-
13+
## Example Usage
14+
15+
```terraform
16+
resource "astronomer_deployment" "dedicated" {
17+
name = "my dedicated deployment"
18+
description = "an example deployment"
19+
type = "DEDICATED"
20+
cluster_id = "clv17vgft000801kkydsws63x"
21+
contact_emails = ["preview@astronomer.test"]
22+
default_task_pod_cpu = "0.25"
23+
default_task_pod_memory = "0.5Gi"
24+
executor = "KUBERNETES"
25+
is_cicd_enforced = true
26+
is_dag_deploy_enabled = true
27+
is_development_mode = false
28+
is_high_availability = true
29+
resource_quota_cpu = "10"
30+
resource_quota_memory = "20Gi"
31+
scheduler_size = "SMALL"
32+
workspace_id = "clnp86ly5000401ndaga21g81"
33+
environment_variables = [{
34+
key = "key1"
35+
value = "value1"
36+
is_secret = false
37+
}]
38+
}
39+
40+
resource "astronomer_deployment" "standard" {
41+
name = "my standard deployment"
42+
description = "an example deployment"
43+
type = "STANDARD"
44+
cloud_provider = "AWS"
45+
region = "us-east-1"
46+
contact_emails = []
47+
default_task_pod_cpu = "0.25"
48+
default_task_pod_memory = "0.5Gi"
49+
executor = "CELERY"
50+
is_cicd_enforced = true
51+
is_dag_deploy_enabled = true
52+
is_development_mode = false
53+
is_high_availability = false
54+
resource_quota_cpu = "10"
55+
resource_quota_memory = "20Gi"
56+
scheduler_size = "SMALL"
57+
workspace_id = "clnp86ly500a401ndaga20g81"
58+
environment_variables = []
59+
worker_queues = [{
60+
name = "default"
61+
is_default = true
62+
astro_machine = "A5"
63+
max_worker_count = 10
64+
min_worker_count = 0
65+
worker_concurrency = 1
66+
}]
67+
}
68+
69+
resource "astronomer_deployment" "hybrid" {
70+
name = "my hybrid deployment"
71+
description = "an example deployment"
72+
type = "HYBRID"
73+
cluster_id = "clnp86ly5000401ndagu20g81"
74+
task_pod_node_pool_id = "clnp86ly5000301ndzfxz895w"
75+
contact_emails = ["example@astronomer.io"]
76+
executor = "KUBERNETES"
77+
is_cicd_enforced = true
78+
is_dag_deploy_enabled = true
79+
scheduler_replicas = 1
80+
scheduler_au = 5
81+
workspace_id = "clnp86ly5000401ndaga20g81"
82+
environment_variables = [{
83+
key = "key1"
84+
value = "value1"
85+
is_secret = false
86+
}]
87+
}
88+
```
1489

1590
<!-- schema generated by tfplugindocs -->
1691
## Schema
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
data "astronomer_organization" "example" {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
resource "astronomer_deployment" "dedicated" {
2+
name = "my dedicated deployment"
3+
description = "an example deployment"
4+
type = "DEDICATED"
5+
cluster_id = "clv17vgft000801kkydsws63x"
6+
contact_emails = ["preview@astronomer.test"]
7+
default_task_pod_cpu = "0.25"
8+
default_task_pod_memory = "0.5Gi"
9+
executor = "KUBERNETES"
10+
is_cicd_enforced = true
11+
is_dag_deploy_enabled = true
12+
is_development_mode = false
13+
is_high_availability = true
14+
resource_quota_cpu = "10"
15+
resource_quota_memory = "20Gi"
16+
scheduler_size = "SMALL"
17+
workspace_id = "clnp86ly5000401ndaga21g81"
18+
environment_variables = [{
19+
key = "key1"
20+
value = "value1"
21+
is_secret = false
22+
}]
23+
}
24+
25+
resource "astronomer_deployment" "standard" {
26+
name = "my standard deployment"
27+
description = "an example deployment"
28+
type = "STANDARD"
29+
cloud_provider = "AWS"
30+
region = "us-east-1"
31+
contact_emails = []
32+
default_task_pod_cpu = "0.25"
33+
default_task_pod_memory = "0.5Gi"
34+
executor = "CELERY"
35+
is_cicd_enforced = true
36+
is_dag_deploy_enabled = true
37+
is_development_mode = false
38+
is_high_availability = false
39+
resource_quota_cpu = "10"
40+
resource_quota_memory = "20Gi"
41+
scheduler_size = "SMALL"
42+
workspace_id = "clnp86ly500a401ndaga20g81"
43+
environment_variables = []
44+
worker_queues = [{
45+
name = "default"
46+
is_default = true
47+
astro_machine = "A5"
48+
max_worker_count = 10
49+
min_worker_count = 0
50+
worker_concurrency = 1
51+
}]
52+
}
53+
54+
resource "astronomer_deployment" "hybrid" {
55+
name = "my hybrid deployment"
56+
description = "an example deployment"
57+
type = "HYBRID"
58+
cluster_id = "clnp86ly5000401ndagu20g81"
59+
task_pod_node_pool_id = "clnp86ly5000301ndzfxz895w"
60+
contact_emails = ["example@astronomer.io"]
61+
executor = "KUBERNETES"
62+
is_cicd_enforced = true
63+
is_dag_deploy_enabled = true
64+
scheduler_replicas = 1
65+
scheduler_au = 5
66+
workspace_id = "clnp86ly5000401ndaga20g81"
67+
environment_variables = [{
68+
key = "key1"
69+
value = "value1"
70+
is_secret = false
71+
}]
72+
}

internal/provider/schemas/deployments.go

+2
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,15 @@ func DeploymentsDataSourceSchemaAttributes() map[string]schema.Attribute {
9696
Optional: true,
9797
Validators: []validator.List{
9898
listvalidator.ValueStringsAre(validators.IsCuid()),
99+
listvalidator.UniqueValues(),
99100
},
100101
},
101102
"workspace_ids": schema.ListAttribute{
102103
ElementType: types.StringType,
103104
Optional: true,
104105
Validators: []validator.List{
105106
listvalidator.ValueStringsAre(validators.IsCuid()),
107+
listvalidator.UniqueValues(),
106108
},
107109
},
108110
"names": schema.ListAttribute{

internal/provider/schemas/workspaces.go

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func WorkspacesDataSourceSchemaAttributes() map[string]schema.Attribute {
3939
ElementType: types.StringType,
4040
Validators: []validator.List{
4141
listvalidator.ValueStringsAre(validators.IsCuid()),
42+
listvalidator.UniqueValues(),
4243
},
4344
Optional: true,
4445
},

0 commit comments

Comments
 (0)