Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

133 bug bash script fixes #139

Merged
merged 12 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from 9 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ website/node_modules
import.tf
generated.tf
import/import_script
terraform-provider-astro-import-script*

website/vendor
test_results
Expand Down
43 changes: 41 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ On Windows:

- `-resources`: Comma-separated list of resources to import. Accepted values are workspace, deployment, cluster, api_token, team, team_roles, user_roles.
- `-token`: API token to authenticate with the Astro platform. If not provided, the script will attempt to use the `ASTRO_API_TOKEN` environment variable.
- `-host`: API host to connect to. Default is https://api.astronomer.io. Use "dev" for https://api.astronomer-dev.io or "stage" for https://api.astronomer-stage.io.
- `-organizationId`: Organization ID to import resources from.
- `-runTerraformInit`: Run `terraform init` after generating the import configuration. Used for initializing the Terraform state in our GitHub Actions.
- `-help`: Display help information.
Expand All @@ -246,7 +245,7 @@ On Windows:

3. Use a different API host (e.g., dev environment):
```
./terraform-provider-astro-import-script_<version-number>_<os>_<arc> -resources workspace -token your_api_token -organizationId your_org_id -host dev
./terraform-provider-astro-import-script_<version-number>_<os>_<arc> -resources workspace -token your_api_token -organizationId your_org_id
```

### Output
Expand All @@ -262,3 +261,43 @@ The script will generate two main files:
- The generated Terraform configurations may require some manual adjustment to match your specific requirements or to resolve any conflicts.
- Always review the generated files before applying them to your Terraform state.

## FAQ and Troubleshooting

### Frequently Asked Questions

1. **What resources can I manage with this Terraform provider?**
- Workspaces, deployments, clusters, hybrid cluster workspace authorizations, API tokens, teams, team roles, and user roles.

2. **How do I authenticate with the Astro API?**
- Use an API token set as the `ASTRO_API_TOKEN` environment variable or provided in the provider configuration.
ichung08 marked this conversation as resolved.
Show resolved Hide resolved

3. **Can I import existing Astro resources into Terraform?**
- Yes, use the Astro Terraform Import Script to generate import blocks and resource configurations.

4. **What Terraform and Go versions are required?**
ichung08 marked this conversation as resolved.
Show resolved Hide resolved
- Terraform >= 1.7 and Go >= 1.21.

5. **How can I contribute to the provider's development?**
- Submit pull requests, report issues, or suggest improvements on the GitHub repository.

### Troubleshooting

1. **Issue: 401 Unauthorized error when running `terraform plan` or `terraform apply`**

Solution: Your API token may have expired. Update your `ASTRO_API_TOKEN` environment variable with a fresh token:
```
export ASTRO_API_TOKEN=<your-new-token>
```

2. **Issue: Import script fails to find resources**

Solution:
- Ensure you have the correct permissions in your Astro organization.
- Verify that your API token is valid and has the necessary scopes.
ichung08 marked this conversation as resolved.
Show resolved Hide resolved
- Double-check the organization ID provided to the script.

3. **Issue: "Error: Invalid provider configuration" when initializing Terraform**

Solution: Ensure your `.terraformrc` file is correctly set up, especially if you're using a local build of the provider for development.

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.
5 changes: 5 additions & 0 deletions docs/data-sources/api_token.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ API Token data source
data "astro_api_token" "example" {
id = "clxm4836f00ql01me3nigmcr6"
}

# Output the API token value using terraform apply
output "api_token" {
value = data.astro_api_token.example
ichung08 marked this conversation as resolved.
Show resolved Hide resolved
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/api_tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ data "astro_api_tokens" "workspace_example" {
data "astro_api_tokens" "deployment_example" {
deployment_id = "clx44jyu001m201m5dzsbexqr"
}

# Output the API tokens value using terraform apply
ichung08 marked this conversation as resolved.
Show resolved Hide resolved
output "api_tokens" {
value = data.astro_api_tokens.example
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Cluster data source
data "astro_cluster" "example" {
id = "clozc036j01to01jrlgvueo8t"
}

# Output the cluster value using terraform apply
output "cluster" {
value = data.astro_cluster.example
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/cluster_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ data "astro_cluster_options" "example_cluster_options_filter_by_provider" {
type = "HYBRID"
cloud_provider = "AWS"
}

# Output the cluster options value using terraform apply
output "cluster_options" {
value = data.astro_cluster_options.example_cluster_options
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ data "astro_clusters" "example_clusters_filter_by_names" {
data "astro_clusters" "example_clusters_filter_by_cloud_provider" {
cloud_provider = "AWS"
}

# Output the clusters value using terraform apply
output "clusters" {
value = data.astro_clusters.example_clusters
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Deployment data source
data "astro_deployment" "example" {
id = "clozc036j01to01jrlgvueo8t"
}

# Output the deployment value using terraform apply
output "deployment" {
value = data.astro_deployment.example
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/deployment_options.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ data "astro_deployment_options" "example_with_executor_query_param" {
data "astro_deployment_options" "example_with_cloud_provider_query_param" {
cloud_provider = "AWS"
}

# Output the deployment options value using terraform apply
output "deployment_options" {
value = data.astro_deployment_options.example
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ data "astro_deployments" "example_deployments_filter_by_deployment_ids" {
data "astro_deployments" "example_deployments_filter_by_workspace_ids" {
workspace_ids = ["clozc036j01to01jrlgvu798d"]
}

# Output the deployments value using terraform apply
output "deployments" {
value = data.astro_deployments.example_deployments
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/organization.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Organization data source

```terraform
data "astro_organization" "example" {}

# Output the organization value using terraform apply
output "organization" {
value = data.astro_organization.example
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/team.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Team data source
data "astro_team" "example" {
id = "clwbclrc100bl01ozjj5s4jmq"
}

# Output the team value using terraform apply
output "team" {
value = data.astro_team.example
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/teams.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ data "astro_teams" "example_teams" {}
data "astro_teams" "example_teams_filter_by_names" {
names = ["my first team", "my second team"]
}

# Output the teams value using terraform apply
output "example_teams" {
value = data.astro_teams.example_teams
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ User data source
data "astro_user" "example" {
id = "clhpichn8002m01mqa4ocs7g6"
}

# Output the user value using terraform apply
output "user" {
value = data.astro_user.example
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ data "astro_users" "example_users_filter_by_workspace_id" {
data "astro_users" "example_users_filter_by_deployment_id" {
deployment_id = "clx44jyu001m201m5dzsbexqr"
}

# Output the users value using terraform apply
output "example_users" {
value = data.astro_users.example_users
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Workspace data source
data "astro_workspace" "example" {
id = "clozc036j01to01jrlgvueo8t"
}

# Output the workspace value using terraform apply
output "workspace" {
ichung08 marked this conversation as resolved.
Show resolved Hide resolved
value = data.astro_workspace.example
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions docs/data-sources/workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ data "astro_workspaces" "example_workspaces_filter_by_workspace_ids" {
data "astro_workspaces" "example_workspaces_filter_by_names" {
names = ["my first workspace", "my second workspace"]
}

# Output the workspaces value using terraform apply
output "example_workspaces" {
value = data.astro_workspaces.example_workspaces
}
```

<!-- schema generated by tfplugindocs -->
Expand Down
5 changes: 5 additions & 0 deletions examples/data-sources/astro_api_token/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
data "astro_api_token" "example" {
id = "clxm4836f00ql01me3nigmcr6"
}

# Output the API token value using terraform apply
output "api_token" {
value = data.astro_api_token.example
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_api_tokens/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ data "astro_api_tokens" "workspace_example" {

data "astro_api_tokens" "deployment_example" {
deployment_id = "clx44jyu001m201m5dzsbexqr"
}

# Output the API tokens value using terraform apply
output "api_tokens" {
value = data.astro_api_tokens.example
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_cluster/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
data "astro_cluster" "example" {
id = "clozc036j01to01jrlgvueo8t"
}

# Output the cluster value using terraform apply
output "cluster" {
value = data.astro_cluster.example
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_cluster_options/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,8 @@ data "astro_cluster_options" "example_cluster_options_filter_by_provider" {
type = "HYBRID"
cloud_provider = "AWS"
}

# Output the cluster options value using terraform apply
output "cluster_options" {
value = data.astro_cluster_options.example_cluster_options
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_clusters/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ data "astro_clusters" "example_clusters_filter_by_names" {

data "astro_clusters" "example_clusters_filter_by_cloud_provider" {
cloud_provider = "AWS"
}

# Output the clusters value using terraform apply
output "clusters" {
value = data.astro_clusters.example_clusters
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_deployment/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
data "astro_deployment" "example" {
id = "clozc036j01to01jrlgvueo8t"
}

# Output the deployment value using terraform apply
output "deployment" {
value = data.astro_deployment.example
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ data "astro_deployment_options" "example_with_executor_query_param" {
data "astro_deployment_options" "example_with_cloud_provider_query_param" {
cloud_provider = "AWS"
}

# Output the deployment options value using terraform apply
output "deployment_options" {
value = data.astro_deployment_options.example
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_deployments/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ data "astro_deployments" "example_deployments_filter_by_deployment_ids" {

data "astro_deployments" "example_deployments_filter_by_workspace_ids" {
workspace_ids = ["clozc036j01to01jrlgvu798d"]
}

# Output the deployments value using terraform apply
output "deployments" {
value = data.astro_deployments.example_deployments
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_organization/data-source.tf
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
data "astro_organization" "example" {}

# Output the organization value using terraform apply
output "organization" {
value = data.astro_organization.example
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_team/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
data "astro_team" "example" {
id = "clwbclrc100bl01ozjj5s4jmq"
}

# Output the team value using terraform apply
output "team" {
value = data.astro_team.example
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_teams/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ data "astro_teams" "example_teams" {}
data "astro_teams" "example_teams_filter_by_names" {
names = ["my first team", "my second team"]
}

# Output the teams value using terraform apply
output "example_teams" {
value = data.astro_teams.example_teams
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_user/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
data "astro_user" "example" {
id = "clhpichn8002m01mqa4ocs7g6"
}

# Output the user value using terraform apply
output "user" {
value = data.astro_user.example
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_users/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ data "astro_users" "example_users_filter_by_workspace_id" {
data "astro_users" "example_users_filter_by_deployment_id" {
deployment_id = "clx44jyu001m201m5dzsbexqr"
}

# Output the users value using terraform apply
output "example_users" {
value = data.astro_users.example_users
}
5 changes: 5 additions & 0 deletions examples/data-sources/astro_workspace/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
data "astro_workspace" "example" {
id = "clozc036j01to01jrlgvueo8t"
}

# Output the workspace value using terraform apply
output "workspace" {
value = data.astro_workspace.example
}
Loading