You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -85,46 +84,30 @@ Ensure you have the following installed:
85
84
4. Update documentation if your changes affect the provider's behavior or add new features.
86
85
87
86
## Testing
87
+
1. Run unit tests with `make test`.
88
88
89
-
1. Run unit tests:
90
-
```
91
-
make test
92
-
```
89
+
2. Run acceptance tests (these will create real resources in your Astro account) with `make testacc`. Acceptance integration tests use a Terraform CLI binary to run real Terraform commands against the Astro API. The goal is to approximate using the provider with Terraform in production as closely as possible.
93
90
94
-
2. Run acceptance tests (these will create real resources in your Astro account):
95
-
```
96
-
make testacc
97
-
```
98
-
Note: Ensure all required environment variables are set as described in `internal/provider/provider_test_utils.go`.
91
+
Using the terraform-plugin-testing framework, each `resource.Test` runs an acceptance test on a resource.
92
+
-`ProtoV6ProviderFactories`: map of the provider factories that the test suite will use to create the provider - just has the `astronomer` provider
93
+
-`PreCheck`: a function that runs before the test suite starts to check that all the required environment variables are set
94
+
-`Steps`: a list of `terraform apply` sequences that the test suite will run. Each step is a `resource.TestStep` that contains a `Config` and `Check` function.
95
+
-`Config`: the Terraform configuration that the test will run (ie. the `.tf` file)
96
+
-`Check`: function that will verify the state of the resources after the `terraform apply` command has run.
99
97
100
-
3. Test your changes manually using the `main.tf` file you created earlier:
101
-
```
102
-
terraform init
103
-
terraform plan
104
-
terraform apply
105
-
```
98
+
In order to run the full suite of Acceptance tests, run `make testacc`.
99
+
You will also need to set all the environment variables described in `internal/provider/provider_test_utils.go`.
106
100
107
-
## Submitting Pull Requests
101
+
The acceptance tests will run against the Astronomer API and create/read/update/delete real resources.
108
102
109
-
1. Commit your changes:
110
-
```
111
-
git add .
112
-
git commit -m "Description of your changes"
113
-
```
103
+
3. Test your changes manually using the main.tf file you created earlier:
114
104
115
-
2. Push your branch to GitHub:
116
105
```
117
-
git push origin feature/your-feature-name
106
+
terraform init
107
+
terraform plan
108
+
terraform apply
118
109
```
119
110
120
-
3. Open a pull request on GitHub.
121
-
122
-
4. In your pull request description, include:
123
-
- A clear description of the changes
124
-
- Any related issue numbers
125
-
- Steps to test the changes
126
-
- Screenshots or code snippets if applicable
127
-
128
111
## Reporting Issues
129
112
130
113
If you encounter a bug or have a suggestion for improvement, please create an issue on the GitHub repository. This helps us track and address problems efficiently.
@@ -176,4 +159,4 @@ If you discover a security vulnerability, please do NOT open an issue. Email sec
1. Create an [API Token](https://docs.astronomer.io/astro/automation-authentication#step-1-create-an-api-token) to use in the provider. We recommend creating an organization API token since it is the most flexible but the type of your API token will depend on your use case.
11
+
1. Create an [API Token](https://docs.astronomer.io/astro/automation-authentication#step-1-create-an-api-token) to use in the provider. Astronomer recommends creating an Organization API token since it is the most flexible but the type of your API token will depend on your use case.
37
12
2. Create a `main.tf` file with the following content:
38
13
```terraform
39
14
terraform {
@@ -50,6 +25,8 @@ provider "astro" {
50
25
51
26
# your terraform commands here
52
27
```
28
+
See [Astro Provider docs](https://registry.terraform.io/providers/astronomer/astro/latest/docs) for supported resources and data sources.
29
+
53
30
3. Run the following commands to apply the provider:
54
31
```shell
55
32
export ASTRO_API_TOKEN=<token>
@@ -58,154 +35,10 @@ terraform plan # creates a plan consisting of a set of changes that will make yo
58
35
terraform apply # performs a plan just like terraform plan does, but then actually carries out the planned changes to each resource using the relevant infrastructure provider's API
59
36
```
60
37
61
-
## Developing the Provider
62
-
63
-
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (see [Requirements](#requirements) above).
64
-
65
-
To compile the provider, see [Building The Provider](#building-the-provider).
66
-
67
-
To add example docs, add the correspond `.tf` files to the `examples` directory. These should be added for every new data source and resource.
68
-
69
-
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:
70
-
71
-
```hcl
72
-
provider_installation {
73
-
dev_overrides {
74
-
"registry.terraform.io/astronomer/astro" = "~/terraform-provider-astro/bin" # Your path to the provider binary
75
-
}
76
-
direct {}
77
-
}
78
-
```
79
-
80
-
## Example `main.tf` file for development and testing data sources and resources
81
-
```terraform
82
-
terraform {
83
-
required_providers {
84
-
astro = {
85
-
source = "astronomer/astro"
86
-
}
87
-
}
88
-
}
89
-
90
-
# provider configuration
91
-
provider "astro" {
92
-
organization_id = "<cuid>"
93
-
}
94
-
95
-
# get information on an existing workspace
96
-
data "astro_workspace" "example" {
97
-
id = "<cuid>"
98
-
}
99
-
100
-
# output the workspace data to the terminal
101
-
output "data_workspace_example" {
102
-
value = data.astro_workspace.example
103
-
}
104
-
105
-
# create a new workspace
106
-
resource "astro_workspace" "tf_workspace" {
107
-
name = "my workspace"
108
-
description = "my first workspace"
109
-
cicd_enforced_default = false
110
-
}
111
-
112
-
# output the newly created workspace resource to the terminal
Acceptance integration tests use a Terraform CLI binary to run real Terraform commands against the Astro API. The goal is to approximate using the provider with Terraform in production as closely as possible.
193
-
194
-
Using the terraform-plugin-testing framework, each `resource.Test` runs an acceptance test on a resource.
195
-
-`ProtoV6ProviderFactories`: map of the provider factories that the test suite will use to create the provider - just has the `astronomer` provider
196
-
-`PreCheck`: a function that runs before the test suite starts to check that all the required environment variables are set
197
-
-`Steps`: a list of `terraform apply` sequences that the test suite will run. Each step is a `resource.TestStep` that contains a `Config` and `Check` function.
198
-
-`Config`: the Terraform configuration that the test will run (ie. the `.tf` file)
199
-
-`Check`: function that will verify the state of the resources after the `terraform apply` command has run.
200
-
201
-
In order to run the full suite of Acceptance tests, run `make testacc`.
202
-
You will also need to set all the environment variables described in `internal/provider/provider_test_utils.go`.
203
-
204
-
The acceptance tests will run against the Astronomer API and create/read/update/delete real resources.
205
-
206
38
## Importing Existing Resources
207
39
The Astro Terraform Import Script is a tool designed to help you import existing Astro resources into your Terraform configuration.
208
-
Currently, this script automates the process of generating Terraform import blocks and resource configurations for the following resources: workspaces, deployments, clusters, hybrid cluster workspace authorizations, API tokens, teams, team roles, and user roles.
40
+
This script automates the process of generating Terraform import blocks and resource configurations for the following resources: workspaces, deployments, clusters, hybrid cluster workspace authorizations, API tokens, teams, team roles, and user roles.
41
+
See Astro's [import script guide](https://registry.terraform.io/providers/astronomer/astro/latest/docs/guides/import-script) for more information.
209
42
210
43
To use the import script, download the `terraform-provider-astro-import-script` executable file from [releases](https://github.com/astronomer/terraform-provider-astro/releases) based on your OS and architecture and run it with the following command:
211
44
@@ -226,26 +59,31 @@ On Windows:
226
59
### Options
227
60
228
61
-`-resources`: Comma-separated list of resources to import. Accepted values are workspace, deployment, cluster, api_token, team, team_roles, user_roles.
229
-
-`-token`: API token to authenticate with the Astro platform. If not provided, the script will attempt to use the `ASTRO_API_TOKEN` environment variable.
230
-
-`-organizationId`: Organization ID to import resources from.
62
+
-`-token`: API token to authenticate with the Astro platform. This requires the Organization Owner role. If not provided, the script will attempt to use the `ASTRO_API_TOKEN` environment variable.
63
+
-`-organizationId`: (Required) Organization ID to import resources from.
231
64
-`-runTerraformInit`: Run `terraform init` after generating the import configuration. Used for initializing the Terraform state in our GitHub Actions.
@@ -277,8 +115,6 @@ The script will generate two main files:
277
115
4.**What Terraform versions are required?**
278
116
- Terraform >= 1.7.
279
117
280
-
5.**How can I contribute to the provider's development?**
281
-
- Submit pull requests, report issues, or suggest improvements on the GitHub repository.
282
118
283
119
### Troubleshooting
284
120
@@ -300,4 +136,4 @@ The script will generate two main files:
300
136
301
137
Solution: Ensure your `.terraformrc` file is correctly set up, especially if you're using a local build of the provider for development.
302
138
303
-
If you encounter any issues not listed here, please check the [GitHub Issues](https://github.com/astronomer/terraform-provider-astro/issues) page or open a new issue with details about your problem.
139
+
If you encounter any issues not listed here, please check the [GitHub Issues](https://github.com/astronomer/terraform-provider-astro/issues) page or open a new issue with details about your problem.
0 commit comments