diff --git a/docs/data-sources/env_aws.md b/docs/data-sources/env_aws.md index a12b539..8fcb683 100644 --- a/docs/data-sources/env_aws.md +++ b/docs/data-sources/env_aws.md @@ -10,13 +10,7 @@ description: |- Bring Your Own Cloud (BYOC) AWS environment data source. -## Example Usage -```terraform -data "altinitycloud_env_aws" "current" { - name = "acme-staging" -} -``` ## Schema diff --git a/docs/data-sources/env_aws_status.md b/docs/data-sources/env_aws_status.md index f2187c8..0cbd97d 100644 --- a/docs/data-sources/env_aws_status.md +++ b/docs/data-sources/env_aws_status.md @@ -1,23 +1,53 @@ --- -# generated by https://github.com/hashicorp/terraform-plugin-docs page_title: "altinitycloud_env_aws_status Data Source - terraform-provider-altinitycloud" subcategory: "" description: |- - Altinity.Cloud AWS environment status data source. It will long pool the status until matching_spec is true. + Altinity.Cloud AWS environment status data source. It will long pool the status until matching_spec is true. Use this data source to wait for the environment is fully provisioned. --- # altinitycloud_env_aws_status (Data Source) -Altinity.Cloud AWS environment status data source. It will long pool the status until `matching_spec` is `true`. +Altinity.Cloud AWS environment status data source. It will long pool the status until `matching_spec` is `true`. Use this data source to wait for the environment is fully provisioned. ## Example Usage +### Read AWS environment status: ```terraform data "altinitycloud_env_aws_status" "current" { name = "acme-staging" } ``` +### Wait for AWS environment to be fully provisioned: +```terraform +resource "altinitycloud_env_aws" "this" { + name = "acme-staging" + aws_account_id = "123456789012" + region = "us-east-1" + zones = ["us-east-1a", "us-east-1b"] + cidr = "10.67.0.0/21" + + node_groups = [ + { + node_type = "t4g.large" + capacity_per_zone = 10 + reservations = ["SYSTEM", "ZOOKEEPER"] + }, + { + node_type = "m6i.large" + capacity_per_zone = 10 + reservations = ["CLICKHOUSE"] + } + ] + cloud_connect = true +} + +data "altinitycloud_env_aws_status" "current" { + name = altinitycloud_env_aws.this.name + wait_for_applied_spec_revision = altinitycloud_env_aws.this.spec_revision +} +``` + ## Schema @@ -30,7 +60,7 @@ data "altinitycloud_env_aws_status" "current" { ### Optional -- `wait_for_applied_spec_revision` (Number) Applied spec revision +- `wait_for_applied_spec_revision` (Number) Use this attribute to wait for the environment to be fully provisioned. It will long pull environment status until it matches the applied spec revision. ### Read-Only diff --git a/docs/data-sources/env_azure.md b/docs/data-sources/env_azure.md index 57292ed..679d3fb 100644 --- a/docs/data-sources/env_azure.md +++ b/docs/data-sources/env_azure.md @@ -10,13 +10,7 @@ description: |- Bring Your Own Cloud (BYOC) Azure environment data source. -## Example Usage -```terraform -data "altinitycloud_env_azure" "current" { - name = "acme-staging" -} -``` ## Schema diff --git a/docs/data-sources/env_azure_status.md b/docs/data-sources/env_azure_status.md index a9666a9..9db0b95 100644 --- a/docs/data-sources/env_azure_status.md +++ b/docs/data-sources/env_azure_status.md @@ -3,20 +3,14 @@ page_title: "altinitycloud_env_azure_status Data Source - terraform-provider-altinitycloud" subcategory: "" description: |- - Altinity.Cloud Azure environment status data source. It will long pool the status until matching_spec is true. + Altinity.Cloud Azure environment status data source. It will long pool the status until matching_spec is true. Use this data source to wait for the environment is fully provisioned. --- # altinitycloud_env_azure_status (Data Source) -Altinity.Cloud Azure environment status data source. It will long pool the status until `matching_spec` is `true`. +Altinity.Cloud Azure environment status data source. It will long pool the status until `matching_spec` is `true`. Use this data source to wait for the environment is fully provisioned. -## Example Usage -```terraform -data "altinitycloud_env_azure_status" "current" { - name = "acme-staging" -} -``` ## Schema @@ -30,7 +24,7 @@ data "altinitycloud_env_azure_status" "current" { ### Optional -- `wait_for_applied_spec_revision` (Number) Applied spec revision +- `wait_for_applied_spec_revision` (Number) Use this attribute to wait for the environment to be fully provisioned. It will long pull environment status until it matches the applied spec revision. ### Read-Only diff --git a/docs/data-sources/env_gcp.md b/docs/data-sources/env_gcp.md index c148e47..aede470 100644 --- a/docs/data-sources/env_gcp.md +++ b/docs/data-sources/env_gcp.md @@ -10,13 +10,7 @@ description: |- Bring Your Own Cloud (BYOC) GCP environment data source. -## Example Usage -```terraform -data "altinitycloud_env_gcp" "current" { - name = "acme-staging" -} -``` ## Schema diff --git a/docs/data-sources/env_gcp_status.md b/docs/data-sources/env_gcp_status.md index ef9e6bd..a8176c7 100644 --- a/docs/data-sources/env_gcp_status.md +++ b/docs/data-sources/env_gcp_status.md @@ -3,20 +3,14 @@ page_title: "altinitycloud_env_gcp_status Data Source - terraform-provider-altinitycloud" subcategory: "" description: |- - Altinity.Cloud GCP environment status data source. It will long pool the status until matching_spec is true. + Altinity.Cloud GCP environment status data source. It will long pool the status until matching_spec is true. Use this data source to wait for the environment is fully provisioned. --- # altinitycloud_env_gcp_status (Data Source) -Altinity.Cloud GCP environment status data source. It will long pool the status until `matching_spec` is `true`. +Altinity.Cloud GCP environment status data source. It will long pool the status until `matching_spec` is `true`. Use this data source to wait for the environment is fully provisioned. -## Example Usage -```terraform -data "altinitycloud_env_gcp_status" "current" { - name = "acme-staging" -} -``` ## Schema @@ -30,7 +24,7 @@ data "altinitycloud_env_gcp_status" "current" { ### Optional -- `wait_for_applied_spec_revision` (Number) Applied spec revision +- `wait_for_applied_spec_revision` (Number) Use this attribute to wait for the environment to be fully provisioned. It will long pull environment status until it matches the applied spec revision. ### Read-Only diff --git a/docs/data-sources/env_k8s.md b/docs/data-sources/env_k8s.md index 2d4a754..016f186 100644 --- a/docs/data-sources/env_k8s.md +++ b/docs/data-sources/env_k8s.md @@ -10,13 +10,7 @@ description: |- Bring Your Own Kubernetes (BYOK) environment data source. -## Example Usage -```terraform -data "altinitycloud_env_k8s" "current" { - name = "acme-staging" -} -``` ## Schema diff --git a/docs/data-sources/env_k8s_status.md b/docs/data-sources/env_k8s_status.md index 57b788c..58ed40c 100644 --- a/docs/data-sources/env_k8s_status.md +++ b/docs/data-sources/env_k8s_status.md @@ -3,20 +3,14 @@ page_title: "altinitycloud_env_k8s_status Data Source - terraform-provider-altinitycloud" subcategory: "" description: |- - Altinity.Cloud K8S environment status data source. It will long pool the status until matching_spec is true. + Altinity.Cloud K8S environment status data source. It will long pool the status until matching_spec is true. Use this data source to wait for the environment is fully provisioned. --- # altinitycloud_env_k8s_status (Data Source) -Altinity.Cloud K8S environment status data source. It will long pool the status until `matching_spec` is `true`. +Altinity.Cloud K8S environment status data source. It will long pool the status until `matching_spec` is `true`. Use this data source to wait for the environment is fully provisioned. -## Example Usage -```terraform -data "altinitycloud_env_k8s_status" "current" { - name = "acme-staging" -} -``` ## Schema @@ -30,7 +24,7 @@ data "altinitycloud_env_k8s_status" "current" { ### Optional -- `wait_for_applied_spec_revision` (Number) Applied spec revision +- `wait_for_applied_spec_revision` (Number) Use this attribute to wait for the environment to be fully provisioned. It will long pull environment status until it matches the applied spec revision. ### Read-Only diff --git a/docs/index.md b/docs/index.md index 7ec26ec..9b594df 100644 --- a/docs/index.md +++ b/docs/index.md @@ -27,7 +27,7 @@ terraform { altinitycloud = { source = "altinity/altinitycloud" # https://github.com/altinity/terraform-provider-altinitycloud/blob/master/CHANGELOG.md - version = "0.2.3" + version = "0.2.6" } } } diff --git a/docs/resources/env_aws.md b/docs/resources/env_aws.md index e576ab7..71ebfc2 100644 --- a/docs/resources/env_aws.md +++ b/docs/resources/env_aws.md @@ -13,7 +13,7 @@ Bring Your Own Cloud (BYOC) AWS environment resource. ## Example Usage -AWS environment with public Load Balancer: +### AWS environment with public Load Balancer: ```terraform resource "altinitycloud_env_certificate" "this" { env_name = "acme-staging" @@ -58,9 +58,15 @@ resource "altinitycloud_env_aws" "this" { module.altinitycloud_connect_aws ] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_aws_status" "this" { + name = altinitycloud_env_aws.this.name + wait_for_applied_spec_revision = altinitycloud_env_aws.this.spec_revision +} ``` -AWS environment accessible over VPC Endpoint: +### AWS environment accessible over VPC Endpoint: ```terraform resource "altinitycloud_env_certificate" "this" { env_name = "acme-staging" @@ -112,6 +118,7 @@ resource "altinitycloud_env_aws" "this" { ] } +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. data "altinitycloud_env_aws_status" "this" { name = altinitycloud_env_aws.this.name wait_for_applied_spec_revision = altinitycloud_env_aws.this.spec_revision @@ -128,7 +135,7 @@ resource "aws_vpc_endpoint" "this" { } ``` -AWS environment with VPC peering: +### AWS environment with VPC peering: ```terraform resource "altinitycloud_env_certificate" "this" { env_name = "acme-staging" @@ -184,6 +191,7 @@ resource "altinitycloud_env_aws" "this" { ] } +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. data "altinitycloud_env_aws_status" "this" { name = altinitycloud_env_aws.this.name wait_for_applied_spec_revision = altinitycloud_env_aws.this.spec_revision @@ -365,7 +373,6 @@ Required: - `key` (String) Name of the key - `value` (String) Value of the key - ## Import Import is supported using the following syntax: diff --git a/docs/resources/env_azure.md b/docs/resources/env_azure.md index ca99e28..8e4aab0 100644 --- a/docs/resources/env_azure.md +++ b/docs/resources/env_azure.md @@ -13,7 +13,7 @@ Bring Your Own Cloud (BYOC) Azure environment resource. ## Example Usage -Azure environment with public Load Balancer: +### Azure environment with public Load Balancer: ```terraform provider "azurerm" { skip_provider_registration = true @@ -63,6 +63,12 @@ resource "altinitycloud_env_azure" "azure" { reservations = ["CLICKHOUSE", "ZOOKEEPER", "SYSTEM"] }] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_azure_status" "this" { + name = altinitycloud_env_azure.this.name + wait_for_applied_spec_revision = altinitycloud_env_azure.this.spec_revision +} ``` @@ -213,7 +219,6 @@ Required: - `key` (String) Name of the key - `value` (String) Value of the key - ## Import Import is supported using the following syntax: diff --git a/docs/resources/env_gcp.md b/docs/resources/env_gcp.md index eef902f..e1a9a3e 100644 --- a/docs/resources/env_gcp.md +++ b/docs/resources/env_gcp.md @@ -11,7 +11,7 @@ Bring Your Own Cloud (BYOC) GCP environment resource. ## Example Usage -GCP environment with public Load Balancer: +### GCP environment with public Load Balancer: ```terraform provider "google" { } @@ -71,6 +71,12 @@ resource "altinitycloud_env_gcp" "this" { } ] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_gcp_status" "this" { + name = altinitycloud_env_gcp.this.name + wait_for_applied_spec_revision = altinitycloud_env_gcp.this.spec_revision +} ``` @@ -199,7 +205,6 @@ Required: Optional: - `enabled` (Boolean) Set to `true` if maintenance window is enabled, `false` otherwise. (default `false`) - ## Import Import is supported using the following syntax: diff --git a/docs/resources/env_k8s.md b/docs/resources/env_k8s.md index eb73de7..666be4a 100644 --- a/docs/resources/env_k8s.md +++ b/docs/resources/env_k8s.md @@ -13,7 +13,7 @@ Bring Your Own Kubernetes (BYOK) environment resource. ## Example Usage -BYOK/EKS (AWS) +### BYOK/EKS (AWS) ```terraform resource "altinitycloud_env_certificate" "this" { env_name = "acme-staging" @@ -50,9 +50,15 @@ resource "altinitycloud_env_k8s" "this" { module.altinitycloud_connect ] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_k8s_status" "this" { + name = altinitycloud_env_k8s.this.name + wait_for_applied_spec_revision = altinitycloud_env_k8s.this.spec_revision +} ``` -BYOK/GKE (GCP): +### BYOK/GKE (GCP): ```terraform resource "altinitycloud_env_certificate" "this" { env_name = "acme-staging" @@ -89,9 +95,15 @@ resource "altinitycloud_env_k8s" "this" { module.altinitycloud_connect ] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_k8s_status" "this" { + name = altinitycloud_env_k8s.this.name + wait_for_applied_spec_revision = altinitycloud_env_k8s.this.spec_revision +} ``` -BYOK/AKS (Azure): +### BYOK/AKS (Azure): ```terraform resource "altinitycloud_env_certificate" "this" { env_name = "acme-staging" @@ -123,6 +135,12 @@ resource "altinitycloud_env_k8s" "this" { module.altinitycloud_connect ] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_k8s_status" "this" { + name = altinitycloud_env_k8s.this.name + wait_for_applied_spec_revision = altinitycloud_env_k8s.this.spec_revision +} ``` @@ -357,7 +375,6 @@ Optional: Optional: - `retention_period_in_days` (Number) Metrics retention period in days (default `30`). - ## Import Import is supported using the following syntax: diff --git a/examples/data-sources/altinitycloud_env_aws/data-source.tf b/examples/data-sources/altinitycloud_env_aws/main.tf similarity index 100% rename from examples/data-sources/altinitycloud_env_aws/data-source.tf rename to examples/data-sources/altinitycloud_env_aws/main.tf diff --git a/examples/data-sources/altinitycloud_env_aws_status/data-source.tf b/examples/data-sources/altinitycloud_env_aws_status/main.tf similarity index 100% rename from examples/data-sources/altinitycloud_env_aws_status/data-source.tf rename to examples/data-sources/altinitycloud_env_aws_status/main.tf diff --git a/examples/data-sources/altinitycloud_env_aws_status/wait.tf b/examples/data-sources/altinitycloud_env_aws_status/wait.tf new file mode 100644 index 0000000..cf2fec8 --- /dev/null +++ b/examples/data-sources/altinitycloud_env_aws_status/wait.tf @@ -0,0 +1,26 @@ +resource "altinitycloud_env_aws" "this" { + name = "acme-staging" + aws_account_id = "123456789012" + region = "us-east-1" + zones = ["us-east-1a", "us-east-1b"] + cidr = "10.67.0.0/21" + + node_groups = [ + { + node_type = "t4g.large" + capacity_per_zone = 10 + reservations = ["SYSTEM", "ZOOKEEPER"] + }, + { + node_type = "m6i.large" + capacity_per_zone = 10 + reservations = ["CLICKHOUSE"] + } + ] + cloud_connect = true +} + +data "altinitycloud_env_aws_status" "current" { + name = altinitycloud_env_aws.this.name + wait_for_applied_spec_revision = altinitycloud_env_aws.this.spec_revision +} diff --git a/examples/data-sources/altinitycloud_env_azure/data-source.tf b/examples/data-sources/altinitycloud_env_azure/main.tf similarity index 100% rename from examples/data-sources/altinitycloud_env_azure/data-source.tf rename to examples/data-sources/altinitycloud_env_azure/main.tf diff --git a/examples/data-sources/altinitycloud_env_azure/wait.tf b/examples/data-sources/altinitycloud_env_azure/wait.tf new file mode 100644 index 0000000..72824fd --- /dev/null +++ b/examples/data-sources/altinitycloud_env_azure/wait.tf @@ -0,0 +1,19 @@ +resource "altinitycloud_env_azure" "azure" { + name = "acme-staging" + cidr = "10.136.0.0/21" + region = "eastus" + zones = ["eastus-1", "eastus-2"] + tenant_id = "f3c1e3cb-3d92-4315-b98c-0a66676da2e8" + subscription_id = "3f919947-3102-4210-82ee-4d2ca69f2a01" + + node_groups = [{ + node_type = "Standard_B2s_v2" + capacity_per_zone = 3 + reservations = ["CLICKHOUSE", "ZOOKEEPER", "SYSTEM"] + }] +} + +data "altinitycloud_env_azure_status" "current" { + name = altinitycloud_env_azure.this.name + wait_for_applied_spec_revision = altinitycloud_env_azure.this.spec_revision +} diff --git a/examples/data-sources/altinitycloud_env_azure_status/data-source.tf b/examples/data-sources/altinitycloud_env_azure_status/main.tf similarity index 100% rename from examples/data-sources/altinitycloud_env_azure_status/data-source.tf rename to examples/data-sources/altinitycloud_env_azure_status/main.tf diff --git a/examples/data-sources/altinitycloud_env_azure_status/wait.tf b/examples/data-sources/altinitycloud_env_azure_status/wait.tf new file mode 100644 index 0000000..cf2fec8 --- /dev/null +++ b/examples/data-sources/altinitycloud_env_azure_status/wait.tf @@ -0,0 +1,26 @@ +resource "altinitycloud_env_aws" "this" { + name = "acme-staging" + aws_account_id = "123456789012" + region = "us-east-1" + zones = ["us-east-1a", "us-east-1b"] + cidr = "10.67.0.0/21" + + node_groups = [ + { + node_type = "t4g.large" + capacity_per_zone = 10 + reservations = ["SYSTEM", "ZOOKEEPER"] + }, + { + node_type = "m6i.large" + capacity_per_zone = 10 + reservations = ["CLICKHOUSE"] + } + ] + cloud_connect = true +} + +data "altinitycloud_env_aws_status" "current" { + name = altinitycloud_env_aws.this.name + wait_for_applied_spec_revision = altinitycloud_env_aws.this.spec_revision +} diff --git a/examples/data-sources/altinitycloud_env_gcp/data-source.tf b/examples/data-sources/altinitycloud_env_gcp/main.tf similarity index 100% rename from examples/data-sources/altinitycloud_env_gcp/data-source.tf rename to examples/data-sources/altinitycloud_env_gcp/main.tf diff --git a/examples/data-sources/altinitycloud_env_gcp_status/data-source.tf b/examples/data-sources/altinitycloud_env_gcp_status/main.tf similarity index 100% rename from examples/data-sources/altinitycloud_env_gcp_status/data-source.tf rename to examples/data-sources/altinitycloud_env_gcp_status/main.tf diff --git a/examples/data-sources/altinitycloud_env_gcp_status/wait.tf b/examples/data-sources/altinitycloud_env_gcp_status/wait.tf new file mode 100644 index 0000000..b169a74 --- /dev/null +++ b/examples/data-sources/altinitycloud_env_gcp_status/wait.tf @@ -0,0 +1,26 @@ +resource "altinitycloud_env_gcp" "this" { + name = "acme-staging" + gcp_project_id = "gcp-project-id" + region = "us-east1" + zones = ["us-east1-b", "us-east1-d"] + cidr = "10.67.0.0/21" + + node_groups = [ + { + node_type = "e2-standard-2" + capacity_per_zone = 10 + reservations = ["SYSTEM", "ZOOKEEPER"] + }, + { + node_type = "n2d-standard-2" + capacity_per_zone = 10 + reservations = ["CLICKHOUSE"] + } + ] +} + + +data "altinitycloud_env_gcp_status" "current" { + name = altinitycloud_env_gcp.this.name + wait_for_applied_spec_revision = altinitycloud_env_gcp.this.spec_revision +} diff --git a/examples/data-sources/altinitycloud_env_k8s/data-source.tf b/examples/data-sources/altinitycloud_env_k8s/main.tf similarity index 100% rename from examples/data-sources/altinitycloud_env_k8s/data-source.tf rename to examples/data-sources/altinitycloud_env_k8s/main.tf diff --git a/examples/data-sources/altinitycloud_env_k8s_status/data-source.tf b/examples/data-sources/altinitycloud_env_k8s_status/main.tf similarity index 100% rename from examples/data-sources/altinitycloud_env_k8s_status/data-source.tf rename to examples/data-sources/altinitycloud_env_k8s_status/main.tf diff --git a/examples/data-sources/altinitycloud_env_k8s_status/wait.tf b/examples/data-sources/altinitycloud_env_k8s_status/wait.tf new file mode 100644 index 0000000..8b972b9 --- /dev/null +++ b/examples/data-sources/altinitycloud_env_k8s_status/wait.tf @@ -0,0 +1,22 @@ +resource "altinitycloud_env_k8s" "this" { + name = "acme-staging" + distribution = "EKS" + + node_groups = [ + { + node_type = "t4g.large" + capacity_per_zone = 10 + reservations = ["SYSTEM", "ZOOKEEPER"] + }, + { + node_type = "m6i.large" + capacity_per_zone = 10 + reservations = ["CLICKHOUSE"] + } + ] +} + +data "altinitycloud_env_k8s_status" "current" { + name = altinitycloud_env_k8s.this.name + wait_for_applied_spec_revision = altinitycloud_env_k8s.this.spec_revision +} diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index f465520..d654198 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -3,7 +3,7 @@ terraform { altinitycloud = { source = "altinity/altinitycloud" # https://github.com/altinity/terraform-provider-altinitycloud/blob/master/CHANGELOG.md - version = "0.2.3" + version = "0.2.6" } } } diff --git a/examples/resources/altinitycloud_env_aws/peering/main.tf b/examples/resources/altinitycloud_env_aws/peering/main.tf index f631fec..6251e83 100644 --- a/examples/resources/altinitycloud_env_aws/peering/main.tf +++ b/examples/resources/altinitycloud_env_aws/peering/main.tf @@ -52,6 +52,7 @@ resource "altinitycloud_env_aws" "this" { ] } +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. data "altinitycloud_env_aws_status" "this" { name = altinitycloud_env_aws.this.name wait_for_applied_spec_revision = altinitycloud_env_aws.this.spec_revision diff --git a/examples/resources/altinitycloud_env_aws/public/main.tf b/examples/resources/altinitycloud_env_aws/public/main.tf index 6c21544..b84e69e 100644 --- a/examples/resources/altinitycloud_env_aws/public/main.tf +++ b/examples/resources/altinitycloud_env_aws/public/main.tf @@ -41,3 +41,9 @@ resource "altinitycloud_env_aws" "this" { module.altinitycloud_connect_aws ] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_aws_status" "this" { + name = altinitycloud_env_aws.this.name + wait_for_applied_spec_revision = altinitycloud_env_aws.this.spec_revision +} diff --git a/examples/resources/altinitycloud_env_aws/vpce/main.tf b/examples/resources/altinitycloud_env_aws/vpce/main.tf index 2d7e556..8b63a4b 100644 --- a/examples/resources/altinitycloud_env_aws/vpce/main.tf +++ b/examples/resources/altinitycloud_env_aws/vpce/main.tf @@ -48,6 +48,7 @@ resource "altinitycloud_env_aws" "this" { ] } +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. data "altinitycloud_env_aws_status" "this" { name = altinitycloud_env_aws.this.name wait_for_applied_spec_revision = altinitycloud_env_aws.this.spec_revision diff --git a/examples/resources/altinitycloud_env_azure/public/main.tf b/examples/resources/altinitycloud_env_azure/public/main.tf index 3c8cdf1..76bf55b 100644 --- a/examples/resources/altinitycloud_env_azure/public/main.tf +++ b/examples/resources/altinitycloud_env_azure/public/main.tf @@ -46,3 +46,9 @@ resource "altinitycloud_env_azure" "azure" { reservations = ["CLICKHOUSE", "ZOOKEEPER", "SYSTEM"] }] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_azure_status" "this" { + name = altinitycloud_env_azure.this.name + wait_for_applied_spec_revision = altinitycloud_env_azure.this.spec_revision +} diff --git a/examples/resources/altinitycloud_env_gcp/public/main.tf b/examples/resources/altinitycloud_env_gcp/public/main.tf index 4650735..41871f6 100644 --- a/examples/resources/altinitycloud_env_gcp/public/main.tf +++ b/examples/resources/altinitycloud_env_gcp/public/main.tf @@ -56,3 +56,9 @@ resource "altinitycloud_env_gcp" "this" { } ] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_gcp_status" "this" { + name = altinitycloud_env_gcp.this.name + wait_for_applied_spec_revision = altinitycloud_env_gcp.this.spec_revision +} diff --git a/examples/resources/altinitycloud_env_k8s/aks/main.tf b/examples/resources/altinitycloud_env_k8s/aks/main.tf index f56555d..8d9e772 100644 --- a/examples/resources/altinitycloud_env_k8s/aks/main.tf +++ b/examples/resources/altinitycloud_env_k8s/aks/main.tf @@ -28,3 +28,9 @@ resource "altinitycloud_env_k8s" "this" { module.altinitycloud_connect ] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_k8s_status" "this" { + name = altinitycloud_env_k8s.this.name + wait_for_applied_spec_revision = altinitycloud_env_k8s.this.spec_revision +} diff --git a/examples/resources/altinitycloud_env_k8s/eks/main.tf b/examples/resources/altinitycloud_env_k8s/eks/main.tf index fcc4024..bfa6b7c 100644 --- a/examples/resources/altinitycloud_env_k8s/eks/main.tf +++ b/examples/resources/altinitycloud_env_k8s/eks/main.tf @@ -33,3 +33,9 @@ resource "altinitycloud_env_k8s" "this" { module.altinitycloud_connect ] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_k8s_status" "this" { + name = altinitycloud_env_k8s.this.name + wait_for_applied_spec_revision = altinitycloud_env_k8s.this.spec_revision +} diff --git a/examples/resources/altinitycloud_env_k8s/gke/main.tf b/examples/resources/altinitycloud_env_k8s/gke/main.tf index 028c17b..66efd21 100644 --- a/examples/resources/altinitycloud_env_k8s/gke/main.tf +++ b/examples/resources/altinitycloud_env_k8s/gke/main.tf @@ -33,3 +33,9 @@ resource "altinitycloud_env_k8s" "this" { module.altinitycloud_connect ] } + +// Since the environment provisioning is an async process, this data source is used to wait for environment to be fully provisioned. +data "altinitycloud_env_k8s_status" "this" { + name = altinitycloud_env_k8s.this.name + wait_for_applied_spec_revision = altinitycloud_env_k8s.this.spec_revision +} diff --git a/internal/provider/common/attributes.go b/internal/provider/common/attributes.go index d04dcca..d8dab52 100644 --- a/internal/provider/common/attributes.go +++ b/internal/provider/common/attributes.go @@ -273,7 +273,7 @@ var SpecRevisionAttribute = rschema.Int64Attribute{ var WaitForAppliedSpecRevisionAttribute = rschema.Int64Attribute{ Optional: true, - MarkdownDescription: STATUS_APPLIED_SPEC_REVISION_DESCRIPTION, + MarkdownDescription: STATUS_WAIT_FOR_APPLIED_SPEC_REVISION_DESCRIPTION, } var AppliedSpecRevisionAttribute = rschema.Int64Attribute{ diff --git a/internal/provider/common/docs.go b/internal/provider/common/docs.go index 0f4c780..04e092a 100644 --- a/internal/provider/common/docs.go +++ b/internal/provider/common/docs.go @@ -93,6 +93,7 @@ const SKIP_PROVISIONING_ON_DESTROY_DESCRIPTION = "Set to `true` will delete with const STATUS_DESCRIPTION = "Environment status" const STATUS_SPEC_REVISION_DESCRIPTION = "Spec revision" const STATUS_APPLIED_SPEC_REVISION_DESCRIPTION = "Applied spec revision" +const STATUS_WAIT_FOR_APPLIED_SPEC_REVISION_DESCRIPTION = "Use this attribute to wait for the environment to be fully provisioned. It will long pull environment status until it matches the applied spec revision." const STATUS_PENDING_DELETE_DESCRIPTION = "`true` indicates that environment is pending deletion" const STATUS_LOAD_BALANCERS_DESCRIPTION = "Status of internal load balancer." const STATUS_LOAD_BALANCERS_INTERNAL_DESCRIPTION = "Status of load balancers." diff --git a/internal/provider/env_status/aws/schema.go b/internal/provider/env_status/aws/schema.go index fd5e306..fd05726 100644 --- a/internal/provider/env_status/aws/schema.go +++ b/internal/provider/env_status/aws/schema.go @@ -12,7 +12,7 @@ import ( func (r *AWSEnvStatusDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ - MarkdownDescription: heredoc.Doc("Altinity.Cloud AWS environment status data source. It will long pool the status until `matching_spec` is `true`."), + MarkdownDescription: heredoc.Doc("Altinity.Cloud AWS environment status data source. It will long pool the status until `matching_spec` is `true`. Use this data source to wait for the environment is fully provisioned."), Attributes: map[string]schema.Attribute{ "id": common.IDAttribute, diff --git a/internal/provider/env_status/azure/schema.go b/internal/provider/env_status/azure/schema.go index 04ae959..865689b 100644 --- a/internal/provider/env_status/azure/schema.go +++ b/internal/provider/env_status/azure/schema.go @@ -11,7 +11,7 @@ import ( func (r *AzureEnvStatusDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ - MarkdownDescription: heredoc.Doc("Altinity.Cloud Azure environment status data source. It will long pool the status until `matching_spec` is `true`."), + MarkdownDescription: heredoc.Doc("Altinity.Cloud Azure environment status data source. It will long pool the status until `matching_spec` is `true`. Use this data source to wait for the environment is fully provisioned."), Attributes: map[string]schema.Attribute{ "id": common.IDAttribute, diff --git a/internal/provider/env_status/gcp/schema.go b/internal/provider/env_status/gcp/schema.go index 791e077..f6dded1 100644 --- a/internal/provider/env_status/gcp/schema.go +++ b/internal/provider/env_status/gcp/schema.go @@ -11,7 +11,7 @@ import ( func (r *GCPEnvStatusDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ - MarkdownDescription: heredoc.Doc("Altinity.Cloud GCP environment status data source. It will long pool the status until `matching_spec` is `true`."), + MarkdownDescription: heredoc.Doc("Altinity.Cloud GCP environment status data source. It will long pool the status until `matching_spec` is `true`. Use this data source to wait for the environment is fully provisioned."), Attributes: map[string]schema.Attribute{ "id": common.IDAttribute, diff --git a/internal/provider/env_status/k8s/schema.go b/internal/provider/env_status/k8s/schema.go index b125dc3..8851010 100644 --- a/internal/provider/env_status/k8s/schema.go +++ b/internal/provider/env_status/k8s/schema.go @@ -11,7 +11,7 @@ import ( func (r *K8SEnvStatusDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ - MarkdownDescription: heredoc.Doc("Altinity.Cloud K8S environment status data source. It will long pool the status until `matching_spec` is `true`."), + MarkdownDescription: heredoc.Doc("Altinity.Cloud K8S environment status data source. It will long pool the status until `matching_spec` is `true`. Use this data source to wait for the environment is fully provisioned."), Attributes: map[string]schema.Attribute{ "id": common.IDAttribute, diff --git a/templates/data-sources/env_aws_status.md.tmpl b/templates/data-sources/env_aws_status.md.tmpl new file mode 100644 index 0000000..b069835 --- /dev/null +++ b/templates/data-sources/env_aws_status.md.tmpl @@ -0,0 +1,20 @@ +--- +page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +## Example Usage + +### Read AWS environment status: +{{tffile "examples/data-sources/altinitycloud_env_aws_status/main.tf"}} + +### Wait for AWS environment to be fully provisioned: +{{tffile "examples/data-sources/altinitycloud_env_aws_status/wait.tf"}} + +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/resources/env_aws.md.tmpl b/templates/resources/env_aws.md.tmpl index 97ee4ed..ac8cbbe 100644 --- a/templates/resources/env_aws.md.tmpl +++ b/templates/resources/env_aws.md.tmpl @@ -13,18 +13,18 @@ description: |- ## Example Usage -AWS environment with public Load Balancer: +### AWS environment with public Load Balancer: {{tffile "examples/resources/altinitycloud_env_aws/public/main.tf"}} -AWS environment accessible over VPC Endpoint: +### AWS environment accessible over VPC Endpoint: {{tffile "examples/resources/altinitycloud_env_aws/vpce/main.tf"}} -AWS environment with VPC peering: +### AWS environment with VPC peering: {{tffile "examples/resources/altinitycloud_env_aws/peering/main.tf"}} {{ .SchemaMarkdown | trimspace }} -{{- if .HasImport }} +{{- if .HasImport }} ## Import Import is supported using the following syntax: diff --git a/templates/resources/env_azure.md.tmpl b/templates/resources/env_azure.md.tmpl index f097943..dd65308 100644 --- a/templates/resources/env_azure.md.tmpl +++ b/templates/resources/env_azure.md.tmpl @@ -13,12 +13,12 @@ description: |- ## Example Usage -Azure environment with public Load Balancer: +### Azure environment with public Load Balancer: {{tffile "examples/resources/altinitycloud_env_azure/public/main.tf"}} {{ .SchemaMarkdown | trimspace }} -{{- if .HasImport }} +{{- if .HasImport }} ## Import Import is supported using the following syntax: diff --git a/templates/resources/env_gcp.md.tmpl b/templates/resources/env_gcp.md.tmpl index 9f24a02..713c235 100644 --- a/templates/resources/env_gcp.md.tmpl +++ b/templates/resources/env_gcp.md.tmpl @@ -11,12 +11,12 @@ description: |- ## Example Usage -GCP environment with public Load Balancer: +### GCP environment with public Load Balancer: {{tffile "examples/resources/altinitycloud_env_gcp/public/main.tf"}} {{ .SchemaMarkdown | trimspace }} -{{- if .HasImport }} +{{- if .HasImport }} ## Import Import is supported using the following syntax: diff --git a/templates/resources/env_k8s.md.tmpl b/templates/resources/env_k8s.md.tmpl index ef13973..d385f37 100644 --- a/templates/resources/env_k8s.md.tmpl +++ b/templates/resources/env_k8s.md.tmpl @@ -13,18 +13,18 @@ description: |- ## Example Usage -BYOK/EKS (AWS) +### BYOK/EKS (AWS) {{tffile "examples/resources/altinitycloud_env_k8s/eks/main.tf"}} -BYOK/GKE (GCP): +### BYOK/GKE (GCP): {{tffile "examples/resources/altinitycloud_env_k8s/gke/main.tf"}} -BYOK/AKS (Azure): +### BYOK/AKS (Azure): {{tffile "examples/resources/altinitycloud_env_k8s/aks/main.tf"}} {{ .SchemaMarkdown | trimspace }} -{{- if .HasImport }} +{{- if .HasImport }} ## Import Import is supported using the following syntax: