From b2c3a39f3f62507c9cf242ea90208a71c9559523 Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Wed, 21 Aug 2024 16:52:16 -0700 Subject: [PATCH 01/12] remove token from provider --- import/import_script.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/import/import_script.go b/import/import_script.go index 9a9a0390..4a263aa8 100644 --- a/import/import_script.go +++ b/import/import_script.go @@ -121,9 +121,8 @@ func main() { provider "astro" { organization_id = "%s" host = "%s" - token = "%s" } -`, organizationId, host, token) +`, organizationId, host) // for each resource, we get the list of entities and generate the terraform import command From af3a7b4de7a324cb133783a37f24e30600191cda Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Wed, 21 Aug 2024 18:50:46 -0700 Subject: [PATCH 02/12] apply feedback from bug bash to fix script --- import/import_script.go | 81 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 5 deletions(-) diff --git a/import/import_script.go b/import/import_script.go index 4a263aa8..007646e9 100644 --- a/import/import_script.go +++ b/import/import_script.go @@ -12,6 +12,8 @@ import ( "strings" "sync" + "github.com/hashicorp/go-version" + "golang.org/x/exp/maps" "github.com/astronomer/terraform-provider-astro/internal/clients/iam" @@ -33,7 +35,7 @@ func main() { log.Println("Terraform Import Script Starting") // collect all arguments from the user, indicating all the resources that need to be imported - resourcesPtr := flag.String("resources", "", "Comma separated list of resources to import. The only accepted values are workspace, deployment, cluster, api_token, team, team_roles, user_roles") + resourcesPtr := flag.String("resources", "workspace,deployment,cluster,api_token,team,team_roles,user_roles", "Comma separated list of resources to import. The only accepted values are workspace, deployment, cluster, api_token, team, team_roles, user_roles") tokenPtr := flag.String("token", "", "API token to authenticate with the platform") hostPtr := flag.String("host", "https://api.astronomer.io", "API host to connect to") organizationIdPtr := flag.String("organizationId", "", "Organization ID to import resources into") @@ -48,6 +50,11 @@ func main() { return } + err := checkRequiredArguments(*resourcesPtr, *tokenPtr, *organizationIdPtr) + if err != nil { + log.Fatalf("Error: %v", err) + } + // validate the resources argument resources := strings.Split(strings.ToLower(*resourcesPtr), ",") acceptedResources := []string{"workspace", "deployment", "cluster", "api_token", "team", "team_roles", "user_roles"} @@ -78,7 +85,7 @@ func main() { } else if *hostPtr == "stage" { host = "https://api.astronomer-stage.io" } else { - host = *hostPtr + host = "https://api.astronomer.io" } // set the organization ID @@ -89,10 +96,10 @@ func main() { log.Printf("Using organization ID: %s", organizationId) - // Check if Terraform is installed - _, err := exec.LookPath("terraform") + // Check if Terraform is installed and the version is supported + err = checkTerraformVersion() if err != nil { - log.Fatalf("Error: Terraform is not installed or not in PATH. Please install Terraform and make sure it's in your system PATH") + log.Fatalf("Error: %v", err) } // connect to v1beta1 client @@ -268,6 +275,70 @@ func printHelp() { log.Println("\nNote: If the -token flag is not provided, the script will attempt to use the ASTRO_API_TOKEN environment variable.") } +func checkRequiredArguments(resourcesPtr string, tokenPtr string, organizationIdPtr string) error { + var missingArgs []string + + // Debug output + fmt.Printf("Debug - resourcesPtr: '%s'\n", resourcesPtr) + fmt.Printf("Debug - tokenPtr: '%s'\n", tokenPtr) + fmt.Printf("Debug - organizationIdPtr: '%s'\n", organizationIdPtr) + + if resourcesPtr == "" { + missingArgs = append(missingArgs, "-resources (comma-separated list: workspace, deployment, cluster, api_token, team, team_roles, user_roles)") + } + + if tokenPtr == "" && len(os.Getenv("ASTRO_API_TOKEN")) == 0 { + missingArgs = append(missingArgs, "-token (or ASTRO_API_TOKEN environment variable)") + } + + if organizationIdPtr == "" { + missingArgs = append(missingArgs, "-organizationId") + } + + if len(missingArgs) > 0 { + fmt.Printf("%s", missingArgs) + return fmt.Errorf("Missing required argument(s):\n%s", strings.Join(missingArgs, "\n")) + } + + return nil +} + +func checkTerraformVersion() error { + // Check if Terraform is installed + _, err := exec.LookPath("terraform") + if err != nil { + return fmt.Errorf("Terraform is not installed or not in PATH. Please install Terraform and make sure it's in your system PATH") + } + + // Get Terraform version + cmd := exec.Command("terraform", "version") + output, err := cmd.Output() + if err != nil { + return fmt.Errorf("Failed to get Terraform version: %v", err) + } + + // Parse the version string + versionStr := strings.TrimSpace(strings.Split(string(output), "\n")[0]) + versionStr = strings.TrimPrefix(versionStr, "Terraform v") + + // Parse the version + currentVersion, err := version.NewVersion(versionStr) + if err != nil { + return fmt.Errorf("Failed to parse Terraform version: %v", err) + } + + // Define the minimum required version + minVersion, _ := version.NewVersion("1.7.0") + + // Compare versions + if currentVersion.LessThan(minVersion) { + return fmt.Errorf("Terraform version %s is required. Your version (%s) is too old. Please upgrade Terraform", minVersion, currentVersion) + } + + fmt.Printf("Terraform version %s is installed and meets the minimum required version.\n", currentVersion) + return nil +} + // generateTerraformConfig runs terraform plan to generate the configuration func generateTerraformConfig() error { // delete the generated.tf file if it exists From 900c3794fd9e578ec9006fef4882ed9690971430 Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Wed, 21 Aug 2024 18:53:42 -0700 Subject: [PATCH 03/12] remove logging comments --- import/import_script.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/import/import_script.go b/import/import_script.go index 007646e9..ceef9435 100644 --- a/import/import_script.go +++ b/import/import_script.go @@ -275,14 +275,10 @@ func printHelp() { log.Println("\nNote: If the -token flag is not provided, the script will attempt to use the ASTRO_API_TOKEN environment variable.") } +// checkRequiredArguments checks if the required arguments are provided func checkRequiredArguments(resourcesPtr string, tokenPtr string, organizationIdPtr string) error { var missingArgs []string - // Debug output - fmt.Printf("Debug - resourcesPtr: '%s'\n", resourcesPtr) - fmt.Printf("Debug - tokenPtr: '%s'\n", tokenPtr) - fmt.Printf("Debug - organizationIdPtr: '%s'\n", organizationIdPtr) - if resourcesPtr == "" { missingArgs = append(missingArgs, "-resources (comma-separated list: workspace, deployment, cluster, api_token, team, team_roles, user_roles)") } @@ -296,13 +292,13 @@ func checkRequiredArguments(resourcesPtr string, tokenPtr string, organizationId } if len(missingArgs) > 0 { - fmt.Printf("%s", missingArgs) return fmt.Errorf("Missing required argument(s):\n%s", strings.Join(missingArgs, "\n")) } return nil } +// checkTerraformVersion checks if Terraform is installed and the version is supported func checkTerraformVersion() error { // Check if Terraform is installed _, err := exec.LookPath("terraform") From cf6de59eca906e81f94ecd19e2233fe99a8b9fec Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Wed, 21 Aug 2024 21:30:44 -0700 Subject: [PATCH 04/12] fix script error --- import/import_script.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/import/import_script.go b/import/import_script.go index ceef9435..abd29d55 100644 --- a/import/import_script.go +++ b/import/import_script.go @@ -220,6 +220,15 @@ provider "astro" { log.Fatalf("Failed to run terraform init: %v", err) return } + + cmd = exec.Command("export ASTRO_API_TOKEN=%s", token) + cmd.Stdout = os.Stdout + cmd.Stderr = os.Stderr + + if err := cmd.Run(); err != nil { + log.Fatalf("Failed to set ASTRO_API_TOKEN: %v", err) + return + } } // Generate the corresponding terraform HCL configuration for each import block From 6d860f50f119e0b1ab9b9c4651b6f8ca8f123736 Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Wed, 21 Aug 2024 21:35:52 -0700 Subject: [PATCH 05/12] fix script error --- import/import_script.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/import/import_script.go b/import/import_script.go index abd29d55..10be361f 100644 --- a/import/import_script.go +++ b/import/import_script.go @@ -199,6 +199,12 @@ provider "astro" { // Trigger terraform init if the flag is set - used to download the provider in CI integration tests if *runTerraformInitPtr { + // Set the ASTRO_API_TOKEN environment variable for the terraform command + err = os.Setenv("ASTRO_API_TOKEN", token) + if err != nil { + return + } + log.Println("Running terraform init") rootDir, err := os.Getwd() @@ -220,15 +226,6 @@ provider "astro" { log.Fatalf("Failed to run terraform init: %v", err) return } - - cmd = exec.Command("export ASTRO_API_TOKEN=%s", token) - cmd.Stdout = os.Stdout - cmd.Stderr = os.Stderr - - if err := cmd.Run(); err != nil { - log.Fatalf("Failed to set ASTRO_API_TOKEN: %v", err) - return - } } // Generate the corresponding terraform HCL configuration for each import block From 18c98de72ab93a43f11726b561283d4a59a49a1b Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Wed, 21 Aug 2024 21:38:13 -0700 Subject: [PATCH 06/12] set token in env --- import/import_script.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/import/import_script.go b/import/import_script.go index 10be361f..a24b73d5 100644 --- a/import/import_script.go +++ b/import/import_script.go @@ -78,6 +78,12 @@ func main() { return } + err = os.Setenv("ASTRO_API_TOKEN", token) + if err != nil { + log.Fatalf("Failed to set ASTRO_API_TOKEN environment variable: %v", err) + return + } + // set the host var host string if *hostPtr == "dev" { @@ -199,12 +205,6 @@ provider "astro" { // Trigger terraform init if the flag is set - used to download the provider in CI integration tests if *runTerraformInitPtr { - // Set the ASTRO_API_TOKEN environment variable for the terraform command - err = os.Setenv("ASTRO_API_TOKEN", token) - if err != nil { - return - } - log.Println("Running terraform init") rootDir, err := os.Getwd() From 94ad7c70ca821c09c5ba18072bbd96998f1965a6 Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Wed, 21 Aug 2024 21:55:20 -0700 Subject: [PATCH 07/12] add FAQ --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.md b/README.md index 88101c13..57fdacd3 100644 --- a/README.md +++ b/README.md @@ -262,3 +262,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. + +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?** + - 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= + ``` + +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. + - 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. \ No newline at end of file From bd0ffd4116c2c2745d7615fb24a43101cf8faf84 Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Thu, 22 Aug 2024 01:39:12 -0700 Subject: [PATCH 08/12] update data source docs --- .gitignore | 1 + docs/data-sources/api_token.md | 5 +++++ docs/data-sources/api_tokens.md | 5 +++++ docs/data-sources/cluster.md | 5 +++++ docs/data-sources/cluster_options.md | 5 +++++ docs/data-sources/clusters.md | 5 +++++ docs/data-sources/deployment.md | 5 +++++ docs/data-sources/deployment_options.md | 5 +++++ docs/data-sources/deployments.md | 5 +++++ docs/data-sources/organization.md | 5 +++++ docs/data-sources/team.md | 5 +++++ docs/data-sources/teams.md | 5 +++++ docs/data-sources/user.md | 5 +++++ docs/data-sources/users.md | 5 +++++ docs/data-sources/workspace.md | 5 +++++ docs/data-sources/workspaces.md | 5 +++++ examples/data-sources/astro_api_token/data-source.tf | 5 +++++ examples/data-sources/astro_api_tokens/data-source.tf | 5 +++++ examples/data-sources/astro_cluster/data-source.tf | 5 +++++ examples/data-sources/astro_cluster_options/data-source.tf | 5 +++++ examples/data-sources/astro_clusters/data-source.tf | 5 +++++ examples/data-sources/astro_deployment/data-source.tf | 5 +++++ .../data-sources/astro_deployment_options/data-source.tf | 5 +++++ examples/data-sources/astro_deployments/data-source.tf | 5 +++++ examples/data-sources/astro_organization/data-source.tf | 5 +++++ examples/data-sources/astro_team/data-source.tf | 5 +++++ examples/data-sources/astro_teams/data-source.tf | 5 +++++ examples/data-sources/astro_user/data-source.tf | 5 +++++ examples/data-sources/astro_users/data-source.tf | 5 +++++ examples/data-sources/astro_workspace/data-source.tf | 5 +++++ examples/data-sources/astro_workspaces/data-source.tf | 5 +++++ 31 files changed, 151 insertions(+) diff --git a/.gitignore b/.gitignore index ef9299ab..7f2e7b5e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,7 @@ website/node_modules import.tf generated.tf import/import_script +terraform-provider-astro-import-script* website/vendor test_results diff --git a/docs/data-sources/api_token.md b/docs/data-sources/api_token.md index c79f4242..52d8e298 100644 --- a/docs/data-sources/api_token.md +++ b/docs/data-sources/api_token.md @@ -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 +} ``` diff --git a/docs/data-sources/api_tokens.md b/docs/data-sources/api_tokens.md index 4936586e..b9e44708 100644 --- a/docs/data-sources/api_tokens.md +++ b/docs/data-sources/api_tokens.md @@ -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 +output "api_tokens" { + value = data.astro_api_tokens.example +} ``` diff --git a/docs/data-sources/cluster.md b/docs/data-sources/cluster.md index 8381e519..e77b70f3 100644 --- a/docs/data-sources/cluster.md +++ b/docs/data-sources/cluster.md @@ -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 +} ``` diff --git a/docs/data-sources/cluster_options.md b/docs/data-sources/cluster_options.md index 55569ffc..b7497ddf 100644 --- a/docs/data-sources/cluster_options.md +++ b/docs/data-sources/cluster_options.md @@ -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 +} ``` diff --git a/docs/data-sources/clusters.md b/docs/data-sources/clusters.md index 654ba22e..d2a7c1a5 100644 --- a/docs/data-sources/clusters.md +++ b/docs/data-sources/clusters.md @@ -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 +} ``` diff --git a/docs/data-sources/deployment.md b/docs/data-sources/deployment.md index 5831ae3e..b6d7f024 100644 --- a/docs/data-sources/deployment.md +++ b/docs/data-sources/deployment.md @@ -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 +} ``` diff --git a/docs/data-sources/deployment_options.md b/docs/data-sources/deployment_options.md index c8a1c143..461ddfd6 100644 --- a/docs/data-sources/deployment_options.md +++ b/docs/data-sources/deployment_options.md @@ -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 +} ``` diff --git a/docs/data-sources/deployments.md b/docs/data-sources/deployments.md index 39ef2c1d..8250168f 100644 --- a/docs/data-sources/deployments.md +++ b/docs/data-sources/deployments.md @@ -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 +} ``` diff --git a/docs/data-sources/organization.md b/docs/data-sources/organization.md index 93cb836f..b8a72d30 100644 --- a/docs/data-sources/organization.md +++ b/docs/data-sources/organization.md @@ -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 +} ``` diff --git a/docs/data-sources/team.md b/docs/data-sources/team.md index f8a8d12f..856d099e 100644 --- a/docs/data-sources/team.md +++ b/docs/data-sources/team.md @@ -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 +} ``` diff --git a/docs/data-sources/teams.md b/docs/data-sources/teams.md index a6d13101..07fef681 100644 --- a/docs/data-sources/teams.md +++ b/docs/data-sources/teams.md @@ -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 +} ``` diff --git a/docs/data-sources/user.md b/docs/data-sources/user.md index 49ffd27c..aa4f42aa 100644 --- a/docs/data-sources/user.md +++ b/docs/data-sources/user.md @@ -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 +} ``` diff --git a/docs/data-sources/users.md b/docs/data-sources/users.md index 31d2abc4..46f7019c 100644 --- a/docs/data-sources/users.md +++ b/docs/data-sources/users.md @@ -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 +} ``` diff --git a/docs/data-sources/workspace.md b/docs/data-sources/workspace.md index b5522e12..a5fc67ac 100644 --- a/docs/data-sources/workspace.md +++ b/docs/data-sources/workspace.md @@ -16,6 +16,11 @@ Workspace data source data "astro_workspace" "example" { id = "clozc036j01to01jrlgvueo8t" } + +# Output the workspace value using terraform apply +output "workspace" { + value = data.astro_workspace.example +} ``` diff --git a/docs/data-sources/workspaces.md b/docs/data-sources/workspaces.md index acfeadc5..394f680c 100644 --- a/docs/data-sources/workspaces.md +++ b/docs/data-sources/workspaces.md @@ -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 +} ``` diff --git a/examples/data-sources/astro_api_token/data-source.tf b/examples/data-sources/astro_api_token/data-source.tf index b67982bd..f1736f9e 100644 --- a/examples/data-sources/astro_api_token/data-source.tf +++ b/examples/data-sources/astro_api_token/data-source.tf @@ -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 } \ No newline at end of file diff --git a/examples/data-sources/astro_api_tokens/data-source.tf b/examples/data-sources/astro_api_tokens/data-source.tf index 6a14c893..3c7bab54 100644 --- a/examples/data-sources/astro_api_tokens/data-source.tf +++ b/examples/data-sources/astro_api_tokens/data-source.tf @@ -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 } \ No newline at end of file diff --git a/examples/data-sources/astro_cluster/data-source.tf b/examples/data-sources/astro_cluster/data-source.tf index 89dcc89e..1c1d352c 100644 --- a/examples/data-sources/astro_cluster/data-source.tf +++ b/examples/data-sources/astro_cluster/data-source.tf @@ -1,3 +1,8 @@ data "astro_cluster" "example" { id = "clozc036j01to01jrlgvueo8t" } + +# Output the cluster value using terraform apply +output "cluster" { + value = data.astro_cluster.example +} \ No newline at end of file diff --git a/examples/data-sources/astro_cluster_options/data-source.tf b/examples/data-sources/astro_cluster_options/data-source.tf index 9b9bae17..713b8b0e 100644 --- a/examples/data-sources/astro_cluster_options/data-source.tf +++ b/examples/data-sources/astro_cluster_options/data-source.tf @@ -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 +} \ No newline at end of file diff --git a/examples/data-sources/astro_clusters/data-source.tf b/examples/data-sources/astro_clusters/data-source.tf index 365df947..ee148a84 100644 --- a/examples/data-sources/astro_clusters/data-source.tf +++ b/examples/data-sources/astro_clusters/data-source.tf @@ -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 } \ No newline at end of file diff --git a/examples/data-sources/astro_deployment/data-source.tf b/examples/data-sources/astro_deployment/data-source.tf index 12660926..e20b5065 100644 --- a/examples/data-sources/astro_deployment/data-source.tf +++ b/examples/data-sources/astro_deployment/data-source.tf @@ -1,3 +1,8 @@ data "astro_deployment" "example" { id = "clozc036j01to01jrlgvueo8t" } + +# Output the deployment value using terraform apply +output "deployment" { + value = data.astro_deployment.example +} \ No newline at end of file diff --git a/examples/data-sources/astro_deployment_options/data-source.tf b/examples/data-sources/astro_deployment_options/data-source.tf index 4beb8d0d..a0de897a 100644 --- a/examples/data-sources/astro_deployment_options/data-source.tf +++ b/examples/data-sources/astro_deployment_options/data-source.tf @@ -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 +} \ No newline at end of file diff --git a/examples/data-sources/astro_deployments/data-source.tf b/examples/data-sources/astro_deployments/data-source.tf index 84d5ddc5..4ee72c88 100644 --- a/examples/data-sources/astro_deployments/data-source.tf +++ b/examples/data-sources/astro_deployments/data-source.tf @@ -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 } \ No newline at end of file diff --git a/examples/data-sources/astro_organization/data-source.tf b/examples/data-sources/astro_organization/data-source.tf index 6e6e6565..dfb619a1 100644 --- a/examples/data-sources/astro_organization/data-source.tf +++ b/examples/data-sources/astro_organization/data-source.tf @@ -1 +1,6 @@ data "astro_organization" "example" {} + +# Output the organization value using terraform apply +output "organization" { + value = data.astro_organization.example +} \ No newline at end of file diff --git a/examples/data-sources/astro_team/data-source.tf b/examples/data-sources/astro_team/data-source.tf index 1828692f..ce485055 100644 --- a/examples/data-sources/astro_team/data-source.tf +++ b/examples/data-sources/astro_team/data-source.tf @@ -1,3 +1,8 @@ data "astro_team" "example" { id = "clwbclrc100bl01ozjj5s4jmq" +} + +# Output the team value using terraform apply +output "team" { + value = data.astro_team.example } \ No newline at end of file diff --git a/examples/data-sources/astro_teams/data-source.tf b/examples/data-sources/astro_teams/data-source.tf index 11230ad4..46ee2d00 100644 --- a/examples/data-sources/astro_teams/data-source.tf +++ b/examples/data-sources/astro_teams/data-source.tf @@ -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 +} \ No newline at end of file diff --git a/examples/data-sources/astro_user/data-source.tf b/examples/data-sources/astro_user/data-source.tf index dae7edae..52e19860 100644 --- a/examples/data-sources/astro_user/data-source.tf +++ b/examples/data-sources/astro_user/data-source.tf @@ -1,3 +1,8 @@ data "astro_user" "example" { id = "clhpichn8002m01mqa4ocs7g6" +} + +# Output the user value using terraform apply +output "user" { + value = data.astro_user.example } \ No newline at end of file diff --git a/examples/data-sources/astro_users/data-source.tf b/examples/data-sources/astro_users/data-source.tf index fbb10034..7b217180 100644 --- a/examples/data-sources/astro_users/data-source.tf +++ b/examples/data-sources/astro_users/data-source.tf @@ -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 +} \ No newline at end of file diff --git a/examples/data-sources/astro_workspace/data-source.tf b/examples/data-sources/astro_workspace/data-source.tf index 225de010..d06e53aa 100644 --- a/examples/data-sources/astro_workspace/data-source.tf +++ b/examples/data-sources/astro_workspace/data-source.tf @@ -1,3 +1,8 @@ data "astro_workspace" "example" { id = "clozc036j01to01jrlgvueo8t" } + +# Output the workspace value using terraform apply +output "workspace" { + value = data.astro_workspace.example +} \ No newline at end of file diff --git a/examples/data-sources/astro_workspaces/data-source.tf b/examples/data-sources/astro_workspaces/data-source.tf index bea59091..6a6c94d0 100644 --- a/examples/data-sources/astro_workspaces/data-source.tf +++ b/examples/data-sources/astro_workspaces/data-source.tf @@ -7,3 +7,8 @@ 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 +} \ No newline at end of file From 3c28f3654577c3ee06765dffc31ee0b05c6ea5ca Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Thu, 22 Aug 2024 11:22:44 -0700 Subject: [PATCH 09/12] remove host info --- README.md | 3 +-- import/import_script.go | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/README.md b/README.md index 57fdacd3..141d9b57 100644 --- a/README.md +++ b/README.md @@ -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. @@ -246,7 +245,7 @@ On Windows: 3. Use a different API host (e.g., dev environment): ``` - ./terraform-provider-astro-import-script___ -resources workspace -token your_api_token -organizationId your_org_id -host dev + ./terraform-provider-astro-import-script___ -resources workspace -token your_api_token -organizationId your_org_id ``` ### Output diff --git a/import/import_script.go b/import/import_script.go index a24b73d5..a60e51ad 100644 --- a/import/import_script.go +++ b/import/import_script.go @@ -266,10 +266,6 @@ func printHelp() { log.Println(" workspace, deployment, cluster, api_token, team, team_roles, user_roles") log.Println(" -token string") log.Println(" API token to authenticate with the platform") - log.Println(" -host string") - log.Println(" API host to connect to (default: https://api.astronomer.io)") - log.Println(" Use 'dev' for https://api.astronomer-dev.io") - log.Println(" Use 'stage' for https://api.astronomer-stage.io") log.Println(" -organizationId string") log.Println(" Organization ID to import resources into") log.Println(" -runTerraformInit") From 2a9f12e9cf4bafaca02cf115743cb44ccf0a9773 Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Thu, 22 Aug 2024 14:45:24 -0700 Subject: [PATCH 10/12] add contributing section --- CONTRIBUTING.md | 178 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..ff4bfcae --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,178 @@ +# Contributing to Terraform Provider Astro + +Welcome to the Terraform Provider Astro project! We're excited that you're interested in contributing. This document will guide you through the process of setting up your development environment, making changes, submitting pull requests, and reporting issues. + +## Table of Contents + +1. [Development Environment Setup](#development-environment-setup) +2. [Making Changes](#making-changes) +3. [Testing](#testing) +4. [Submitting Pull Requests](#submitting-pull-requests) +5. [Reporting Issues](#reporting-issues) +6. [Best Practices](#best-practices) +7. [Additional Resources](#additional-resources) + +## Development Environment Setup + +### Prerequisites + +Ensure you have the following installed: +- [Terraform](https://developer.hashicorp.com/terraform/downloads) >= 1.7 +- [Go](https://golang.org/doc/install) >= 1.21 + +### Setting up the Provider for Local Development + +1. Clone the repository: + ``` + git clone https://github.com/astronomer/terraform-provider-astro.git + cd terraform-provider-astro + ``` + +2. Build the provider: + ``` + make dep + make build + ``` + +3. Create a `.terraformrc` file in your home directory (`~`) with the following content: + ```hcl + provider_installation { + dev_overrides { + "registry.terraform.io/astronomer/astro" = "/path/to/your/terraform-provider-astro/bin" + } + direct {} + } + ``` + Replace `/path/to/your/terraform-provider-astro/bin` with the actual path to the `bin` directory in your cloned repository. + +4. Create a `main.tf` file for testing: + ```hcl + terraform { + required_providers { + astro = { + source = "astronomer/astro" + } + } + } + + provider "astro" { + organization_id = "" + } + + # Add resources and data sources here for testing + ``` + +5. Set up your Astro API token: + ``` + export ASTRO_API_TOKEN= + ``` + +## Making Changes + +1. Create a new branch for your changes: + ``` + git checkout -b feature/your-feature-name + ``` + +2. Make your changes in the appropriate files. Common areas for changes include: + - `internal/provider/` for provider logic + - `internal/resources/` for resource implementations + - `internal/datasources/` for data source implementations + - `examples/` for example configurations + +3. Update or add tests in the corresponding `*_test.go` files. If a new data source or resource is added, create a new test file in the `*_test.go` file for that feature. + +4. Update documentation if your changes affect the provider's behavior or add new features. + +## Testing + +1. Run unit tests: + ``` + make test + ``` + +2. Run acceptance tests (these will create real resources in your Astro account): + ``` + make testacc + ``` + Note: Ensure all required environment variables are set as described in `internal/provider/provider_test_utils.go`. + +3. Test your changes manually using the `main.tf` file you created earlier: + ``` + terraform init + terraform plan + terraform apply + ``` + +## Submitting Pull Requests + +1. Commit your changes: + ``` + git add . + git commit -m "Description of your changes" + ``` + +2. Push your branch to GitHub: + ``` + git push origin feature/your-feature-name + ``` + +3. Open a pull request on GitHub. + +4. In your pull request description, include: + - A clear description of the changes + - Any related issue numbers + - Steps to test the changes + - Screenshots or code snippets if applicable + +## Reporting Issues + +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. + +### Creating an Issue + +1. Go to the [Issues page](https://github.com/astronomer/terraform-provider-astro/issues) of the repository. +2. Click on "New Issue". +3. Choose the appropriate issue template if available, or start with a blank issue. +4. Provide a clear and concise title that summarizes the issue. +5. In the description, include: + - A detailed description of the bug or feature request + - Steps to reproduce the issue (for bugs) + - Expected behavior + - Actual behavior (for bugs) + - Screenshots or error messages, if applicable + - Your environment details: + - Terraform version + - Terraform Provider Astro version + - Operating System + - Any other relevant information +6. Add appropriate labels to the issue (e.g., "bug", "enhancement", "documentation") +7. Submit the issue + +### Best Practices for Issue Reporting + +- Search existing issues before creating a new one to avoid duplicates. +- One issue per report. If you have multiple bugs or feature requests, create separate issues for each. +- Be responsive to questions or requests for additional information. +- If you find a solution to your problem before the issue is resolved, add a comment describing the solution for others who might encounter the same issue. + +### Security Issues + +If you discover a security vulnerability, please do NOT open an issue. Email security@astronomer.io instead. + +## Best Practices + +- Follow Go best practices and conventions. +- Ensure your code is well-commented and easy to understand. +- Keep your changes focused. If you're working on multiple features, submit separate pull requests. +- Update the README.md if your changes affect the overall usage of the provider. +- Add example configurations to the `examples/` directory for any new features or resources. +- If you're adding a new resource or data source, ensure you've added corresponding acceptance tests. + +## Additional Resources + +- [Terraform Plugin Framework Documentation](https://developer.hashicorp.com/terraform/plugin/framework) +- [Go Documentation](https://golang.org/doc/) +- [Astro API Documentation](https://docs.astronomer.io/astro/api-overview) + +Thank you for contributing to the Terraform Provider Astro project! Your efforts help improve the experience for all Astro users. \ No newline at end of file From 4bd487dc48d5d4aa981869fb37e60a3b406b6a2c Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Thu, 22 Aug 2024 14:47:14 -0700 Subject: [PATCH 11/12] add resource link --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ff4bfcae..0301e566 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -171,8 +171,9 @@ If you discover a security vulnerability, please do NOT open an issue. Email sec ## Additional Resources +- [Terraform Provider Astro Documentation](https://registry.terraform.io/providers/astronomer/astro/latest/docs) +- [Astro API Documentation](https://docs.astronomer.io/astro/api-overview) - [Terraform Plugin Framework Documentation](https://developer.hashicorp.com/terraform/plugin/framework) - [Go Documentation](https://golang.org/doc/) -- [Astro API Documentation](https://docs.astronomer.io/astro/api-overview) Thank you for contributing to the Terraform Provider Astro project! Your efforts help improve the experience for all Astro users. \ No newline at end of file From 9c6463f38d220bf1209e6269938b3ce65c6a8466 Mon Sep 17 00:00:00 2001 From: Isaac Chung Date: Thu, 22 Aug 2024 14:53:50 -0700 Subject: [PATCH 12/12] address comments --- README.md | 8 ++++---- docs/data-sources/api_token.md | 6 +++--- docs/data-sources/api_tokens.md | 6 +++--- docs/data-sources/cluster.md | 4 ++-- docs/data-sources/deployment.md | 4 ++-- docs/data-sources/deployment_options.md | 4 ++-- docs/data-sources/organization.md | 4 ++-- docs/data-sources/team.md | 4 ++-- docs/data-sources/user.md | 4 ++-- docs/data-sources/workspace.md | 4 ++-- examples/data-sources/astro_api_token/data-source.tf | 6 +++--- examples/data-sources/astro_api_tokens/data-source.tf | 6 +++--- examples/data-sources/astro_cluster/data-source.tf | 4 ++-- examples/data-sources/astro_deployment/data-source.tf | 4 ++-- .../data-sources/astro_deployment_options/data-source.tf | 4 ++-- examples/data-sources/astro_organization/data-source.tf | 4 ++-- examples/data-sources/astro_team/data-source.tf | 4 ++-- examples/data-sources/astro_user/data-source.tf | 4 ++-- examples/data-sources/astro_workspace/data-source.tf | 4 ++-- 19 files changed, 44 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 141d9b57..2daf6683 100644 --- a/README.md +++ b/README.md @@ -269,13 +269,13 @@ The script will generate two main files: - 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. + - Use an API token set as the `ASTRO_API_TOKEN` environment variable or add it to the provider configuration. 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?** - - Terraform >= 1.7 and Go >= 1.21. +4. **What Terraform versions are required?** + - Terraform >= 1.7. 5. **How can I contribute to the provider's development?** - Submit pull requests, report issues, or suggest improvements on the GitHub repository. @@ -293,7 +293,7 @@ The script will generate two main files: Solution: - Ensure you have the correct permissions in your Astro organization. - - Verify that your API token is valid and has the necessary scopes. + - Verify that your API token is valid and has the necessary scopes and permissions. - Double-check the organization ID provided to the script. 3. **Issue: "Error: Invalid provider configuration" when initializing Terraform** diff --git a/docs/data-sources/api_token.md b/docs/data-sources/api_token.md index 52d8e298..a23b559a 100644 --- a/docs/data-sources/api_token.md +++ b/docs/data-sources/api_token.md @@ -13,13 +13,13 @@ API Token data source ## Example Usage ```terraform -data "astro_api_token" "example" { +data "astro_api_token" "example_api_token" { id = "clxm4836f00ql01me3nigmcr6" } -# Output the API token value using terraform apply +# Output the API token using terraform apply output "api_token" { - value = data.astro_api_token.example + value = data.astro_api_token.example_api_token } ``` diff --git a/docs/data-sources/api_tokens.md b/docs/data-sources/api_tokens.md index b9e44708..b172b53f 100644 --- a/docs/data-sources/api_tokens.md +++ b/docs/data-sources/api_tokens.md @@ -13,7 +13,7 @@ API Tokens data source ## Example Usage ```terraform -data "astro_api_tokens" "example" {} +data "astro_api_tokens" "example_api_tokens" {} data "astro_api_tokens" "organization_only_example" { include_only_organization_tokens = true @@ -27,9 +27,9 @@ data "astro_api_tokens" "deployment_example" { deployment_id = "clx44jyu001m201m5dzsbexqr" } -# Output the API tokens value using terraform apply +# Output the API tokens using terraform apply output "api_tokens" { - value = data.astro_api_tokens.example + value = data.astro_api_tokens.example_api_tokens } ``` diff --git a/docs/data-sources/cluster.md b/docs/data-sources/cluster.md index e77b70f3..8f5d2d9c 100644 --- a/docs/data-sources/cluster.md +++ b/docs/data-sources/cluster.md @@ -13,13 +13,13 @@ Cluster data source ## Example Usage ```terraform -data "astro_cluster" "example" { +data "astro_cluster" "example_cluster" { id = "clozc036j01to01jrlgvueo8t" } # Output the cluster value using terraform apply output "cluster" { - value = data.astro_cluster.example + value = data.astro_cluster.example_cluster } ``` diff --git a/docs/data-sources/deployment.md b/docs/data-sources/deployment.md index b6d7f024..c79f5d53 100644 --- a/docs/data-sources/deployment.md +++ b/docs/data-sources/deployment.md @@ -13,13 +13,13 @@ Deployment data source ## Example Usage ```terraform -data "astro_deployment" "example" { +data "astro_deployment" "example_deployment" { id = "clozc036j01to01jrlgvueo8t" } # Output the deployment value using terraform apply output "deployment" { - value = data.astro_deployment.example + value = data.astro_deployment.example_deployment } ``` diff --git a/docs/data-sources/deployment_options.md b/docs/data-sources/deployment_options.md index 461ddfd6..099918d4 100644 --- a/docs/data-sources/deployment_options.md +++ b/docs/data-sources/deployment_options.md @@ -13,7 +13,7 @@ Deployment options data source ## Example Usage ```terraform -data "astro_deployment_options" "example" {} +data "astro_deployment_options" "example_deployment_options" {} data "astro_deployment_options" "example_with_deployment_id_query_param" { deployment_id = "clozc036j01to01jrlgvueo8t" @@ -33,7 +33,7 @@ data "astro_deployment_options" "example_with_cloud_provider_query_param" { # Output the deployment options value using terraform apply output "deployment_options" { - value = data.astro_deployment_options.example + value = data.astro_deployment_options.example_deployment_options } ``` diff --git a/docs/data-sources/organization.md b/docs/data-sources/organization.md index b8a72d30..48045ebf 100644 --- a/docs/data-sources/organization.md +++ b/docs/data-sources/organization.md @@ -13,11 +13,11 @@ Organization data source ## Example Usage ```terraform -data "astro_organization" "example" {} +data "astro_organization" "example_organization" {} # Output the organization value using terraform apply output "organization" { - value = data.astro_organization.example + value = data.astro_organization.example_organization } ``` diff --git a/docs/data-sources/team.md b/docs/data-sources/team.md index 856d099e..187def04 100644 --- a/docs/data-sources/team.md +++ b/docs/data-sources/team.md @@ -13,13 +13,13 @@ Team data source ## Example Usage ```terraform -data "astro_team" "example" { +data "astro_team" "example_team" { id = "clwbclrc100bl01ozjj5s4jmq" } # Output the team value using terraform apply output "team" { - value = data.astro_team.example + value = data.astro_team.example_team } ``` diff --git a/docs/data-sources/user.md b/docs/data-sources/user.md index aa4f42aa..b71bbb7b 100644 --- a/docs/data-sources/user.md +++ b/docs/data-sources/user.md @@ -13,13 +13,13 @@ User data source ## Example Usage ```terraform -data "astro_user" "example" { +data "astro_user" "example_user" { id = "clhpichn8002m01mqa4ocs7g6" } # Output the user value using terraform apply output "user" { - value = data.astro_user.example + value = data.astro_user.example_user } ``` diff --git a/docs/data-sources/workspace.md b/docs/data-sources/workspace.md index a5fc67ac..0fae3d5d 100644 --- a/docs/data-sources/workspace.md +++ b/docs/data-sources/workspace.md @@ -13,13 +13,13 @@ Workspace data source ## Example Usage ```terraform -data "astro_workspace" "example" { +data "astro_workspace" "example_workspace" { id = "clozc036j01to01jrlgvueo8t" } # Output the workspace value using terraform apply output "workspace" { - value = data.astro_workspace.example + value = data.astro_workspace.example_workspace } ``` diff --git a/examples/data-sources/astro_api_token/data-source.tf b/examples/data-sources/astro_api_token/data-source.tf index f1736f9e..e5d90d8c 100644 --- a/examples/data-sources/astro_api_token/data-source.tf +++ b/examples/data-sources/astro_api_token/data-source.tf @@ -1,8 +1,8 @@ -data "astro_api_token" "example" { +data "astro_api_token" "example_api_token" { id = "clxm4836f00ql01me3nigmcr6" } -# Output the API token value using terraform apply +# Output the API token using terraform apply output "api_token" { - value = data.astro_api_token.example + value = data.astro_api_token.example_api_token } \ No newline at end of file diff --git a/examples/data-sources/astro_api_tokens/data-source.tf b/examples/data-sources/astro_api_tokens/data-source.tf index 3c7bab54..78e07f77 100644 --- a/examples/data-sources/astro_api_tokens/data-source.tf +++ b/examples/data-sources/astro_api_tokens/data-source.tf @@ -1,4 +1,4 @@ -data "astro_api_tokens" "example" {} +data "astro_api_tokens" "example_api_tokens" {} data "astro_api_tokens" "organization_only_example" { include_only_organization_tokens = true @@ -12,7 +12,7 @@ data "astro_api_tokens" "deployment_example" { deployment_id = "clx44jyu001m201m5dzsbexqr" } -# Output the API tokens value using terraform apply +# Output the API tokens using terraform apply output "api_tokens" { - value = data.astro_api_tokens.example + value = data.astro_api_tokens.example_api_tokens } \ No newline at end of file diff --git a/examples/data-sources/astro_cluster/data-source.tf b/examples/data-sources/astro_cluster/data-source.tf index 1c1d352c..619adf73 100644 --- a/examples/data-sources/astro_cluster/data-source.tf +++ b/examples/data-sources/astro_cluster/data-source.tf @@ -1,8 +1,8 @@ -data "astro_cluster" "example" { +data "astro_cluster" "example_cluster" { id = "clozc036j01to01jrlgvueo8t" } # Output the cluster value using terraform apply output "cluster" { - value = data.astro_cluster.example + value = data.astro_cluster.example_cluster } \ No newline at end of file diff --git a/examples/data-sources/astro_deployment/data-source.tf b/examples/data-sources/astro_deployment/data-source.tf index e20b5065..a2251db6 100644 --- a/examples/data-sources/astro_deployment/data-source.tf +++ b/examples/data-sources/astro_deployment/data-source.tf @@ -1,8 +1,8 @@ -data "astro_deployment" "example" { +data "astro_deployment" "example_deployment" { id = "clozc036j01to01jrlgvueo8t" } # Output the deployment value using terraform apply output "deployment" { - value = data.astro_deployment.example + value = data.astro_deployment.example_deployment } \ No newline at end of file diff --git a/examples/data-sources/astro_deployment_options/data-source.tf b/examples/data-sources/astro_deployment_options/data-source.tf index a0de897a..e6aeffdd 100644 --- a/examples/data-sources/astro_deployment_options/data-source.tf +++ b/examples/data-sources/astro_deployment_options/data-source.tf @@ -1,4 +1,4 @@ -data "astro_deployment_options" "example" {} +data "astro_deployment_options" "example_deployment_options" {} data "astro_deployment_options" "example_with_deployment_id_query_param" { deployment_id = "clozc036j01to01jrlgvueo8t" @@ -18,5 +18,5 @@ data "astro_deployment_options" "example_with_cloud_provider_query_param" { # Output the deployment options value using terraform apply output "deployment_options" { - value = data.astro_deployment_options.example + value = data.astro_deployment_options.example_deployment_options } \ No newline at end of file diff --git a/examples/data-sources/astro_organization/data-source.tf b/examples/data-sources/astro_organization/data-source.tf index dfb619a1..ba0dc691 100644 --- a/examples/data-sources/astro_organization/data-source.tf +++ b/examples/data-sources/astro_organization/data-source.tf @@ -1,6 +1,6 @@ -data "astro_organization" "example" {} +data "astro_organization" "example_organization" {} # Output the organization value using terraform apply output "organization" { - value = data.astro_organization.example + value = data.astro_organization.example_organization } \ No newline at end of file diff --git a/examples/data-sources/astro_team/data-source.tf b/examples/data-sources/astro_team/data-source.tf index ce485055..92d0ff7e 100644 --- a/examples/data-sources/astro_team/data-source.tf +++ b/examples/data-sources/astro_team/data-source.tf @@ -1,8 +1,8 @@ -data "astro_team" "example" { +data "astro_team" "example_team" { id = "clwbclrc100bl01ozjj5s4jmq" } # Output the team value using terraform apply output "team" { - value = data.astro_team.example + value = data.astro_team.example_team } \ No newline at end of file diff --git a/examples/data-sources/astro_user/data-source.tf b/examples/data-sources/astro_user/data-source.tf index 52e19860..fc13ccfc 100644 --- a/examples/data-sources/astro_user/data-source.tf +++ b/examples/data-sources/astro_user/data-source.tf @@ -1,8 +1,8 @@ -data "astro_user" "example" { +data "astro_user" "example_user" { id = "clhpichn8002m01mqa4ocs7g6" } # Output the user value using terraform apply output "user" { - value = data.astro_user.example + value = data.astro_user.example_user } \ No newline at end of file diff --git a/examples/data-sources/astro_workspace/data-source.tf b/examples/data-sources/astro_workspace/data-source.tf index d06e53aa..e4e38a85 100644 --- a/examples/data-sources/astro_workspace/data-source.tf +++ b/examples/data-sources/astro_workspace/data-source.tf @@ -1,8 +1,8 @@ -data "astro_workspace" "example" { +data "astro_workspace" "example_workspace" { id = "clozc036j01to01jrlgvueo8t" } # Output the workspace value using terraform apply output "workspace" { - value = data.astro_workspace.example + value = data.astro_workspace.example_workspace } \ No newline at end of file