From c1bb2f4b5d5f7b914b7836dcd9603050df11b74d Mon Sep 17 00:00:00 2001 From: atovpeko Date: Fri, 28 Feb 2025 13:06:25 +0200 Subject: [PATCH 1/3] draft --- use-timescale/integrations/index.md | 7 +- use-timescale/integrations/pulumi.md | 122 +++++++++++++++++++++++++++ 2 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 use-timescale/integrations/pulumi.md diff --git a/use-timescale/integrations/index.md b/use-timescale/integrations/index.md index aa09fc9ff7..f4af749362 100644 --- a/use-timescale/integrations/index.md +++ b/use-timescale/integrations/index.md @@ -40,9 +40,10 @@ Some of the most in-demand integrations for $CLOUD_LONG are listed below, with l ## Configuration and deployment -| Name | Description | -|:---------------------------:|--------------------------------------------------------------------------| -| [Terraform][terraform] | Safely and predictably provision and manage infrastructure in any cloud. | +| Name | Description | +|:----------------------:|-----------------------------------------------------------------------------------------------------------------------| +| [Terraform][terraform] | Safely and predictably provision and manage infrastructure in any cloud. | +| [Pulumi][pulumi] | Define, deploy, and manage cloud infrastructure as code across multi-cloud, Kubernetes, and on-premises environments. | ## Data engineering and extract, transform, load diff --git a/use-timescale/integrations/pulumi.md b/use-timescale/integrations/pulumi.md new file mode 100644 index 0000000000..587215cbef --- /dev/null +++ b/use-timescale/integrations/pulumi.md @@ -0,0 +1,122 @@ +--- +title: Integrate Pulumi with Timescale Cloud +excerpt: Manage your Timescale Cloud services with a Terraform provider +products: [cloud] +keywords: [Terraform, configuration, deployment] +tags: [integrate] +--- + +import IntegrationPrereqs from "versionContent/_partials/_integration-prereqs.mdx"; + +# Integrate Pulumi with $CLOUD_LONG + +Pulumi is an open-source infrastructure as code platform that enables you to define, deploy, and manage your infrastructure and applications across multi-cloud, Kubernetes, and on-premises environments. + +This page explains how to configure Pulumi to manage your $SERVICE_LONG or a self-hosted database. + +## Prerequisites + + + +* [Download and install][pulumi-install] Pulumi v1.0 or later. + +## Configure Pulumi + +You use the [$COMPANY Terraform provider][terraform-provider] with Pulumi to manage $SERVICE_LONGs: + + + +1. + +1. **Install $COMPANY Terraform provider** + + ```bash + pulumi package add terraform-provider timescale/timescale + ``` + +1. **Generate client credentials for programmatic use** + + 1. In [$CONSOLE][console], click `Timescale project` and save your `Project ID`, then click `Project settings`. + + 1. Click `Create credentials`, then save `Public key` and `Secret key`. + +1. **Configure $COMPANY Terraform provider** + + 1. Create a `main.tf` configuration file with at least the following content. Change `x.y.z` to the [latest version][terraform-provider] of the provider. + + ```hcl + terraform { + required_providers { + timescale = { + source = "timescale/timescale" + version = "x.y.z" + } + } + } + + # Authenticate using client credentials generated in Timescale Console. + # When required, these credentials will change to a short-lived JWT to do the calls. + provider "timescale" { + project_id = var.ts_project_id + access_key = var.ts_access_key + secret_key = var.ts_secret_key + } + + variable "ts_project_id" { + type = string + } + + variable "ts_access_key" { + type = string + } + + variable "ts_secret_key" { + type = string + } + ``` + + 1. Create a `terraform.tfvars` file in the same directory as your `main.tf` to pass in the variable values: + + ```hcl + export TF_VAR_ts_project_id="" + export TF_VAR_ts_access_key="" + export TF_VAR_ts_secret_key="" + ``` + +1. **Add your resources** + + Add your $SERVICE_LONGs or $VPC connections to the `main.tf` configuration file. For example: + + ```hcl + resource "timescale_service" "test" { + name = "test-service" + milli_cpu = 500 + memory_gb = 2 + region_code = "us-east-1" + enable_ha_replica = false + + timeouts = { + create = "30m" + } + } + + resource "timescale_vpc" "vpc" { + cidr = "10.10.0.0/16" + name = "test-vpc" + region_code = "us-east-1" + } + ``` + +You can now manage your resources with Pulumi. See more about [available resources][terraform-resources] and [data sources][terraform-data-sources]. + + + + +[pulumi-install]: https://www.pulumi.com/docs/iac/download-install/ +[terraform]: https://www.terraform.io/ +[console]: https://console.cloud.timescale.com/dashboard/services +[terraform-provider]: https://registry.terraform.io/providers/timescale/timescale/latest/docs +[connection-info]: /use-timescale/:currentVersion:/integrations/find-connection-details/ +[terraform-resources]: https://registry.terraform.io/providers/timescale/timescale/latest/docs/resources/peering_connection +[terraform-data-sources]: https://registry.terraform.io/providers/timescale/timescale/latest/docs/data-sources/products +[pg-provider]: https://registry.terraform.io/providers/cyrilgdn/postgresql/latest \ No newline at end of file From 86f3c70e3e417b5a15801e2bfe9e4b67715d6c3d Mon Sep 17 00:00:00 2001 From: atovpeko Date: Fri, 28 Feb 2025 15:30:27 +0200 Subject: [PATCH 2/3] update --- use-timescale/integrations/pulumi.md | 126 ++++++++++++------------- use-timescale/page-index/page-index.js | 5 + 2 files changed, 64 insertions(+), 67 deletions(-) diff --git a/use-timescale/integrations/pulumi.md b/use-timescale/integrations/pulumi.md index 587215cbef..68a1f74331 100644 --- a/use-timescale/integrations/pulumi.md +++ b/use-timescale/integrations/pulumi.md @@ -10,7 +10,7 @@ import IntegrationPrereqs from "versionContent/_partials/_integration-prereqs.md # Integrate Pulumi with $CLOUD_LONG -Pulumi is an open-source infrastructure as code platform that enables you to define, deploy, and manage your infrastructure and applications across multi-cloud, Kubernetes, and on-premises environments. +Pulumi is an open-source infrastructure as code platform that enables you to define, deploy, and manage your infrastructure and applications across multi-cloud and on-premises environments. This page explains how to configure Pulumi to manage your $SERVICE_LONG or a self-hosted database. @@ -26,94 +26,86 @@ You use the [$COMPANY Terraform provider][terraform-provider] with Pulumi to man -1. - -1. **Install $COMPANY Terraform provider** - - ```bash - pulumi package add terraform-provider timescale/timescale - ``` - 1. **Generate client credentials for programmatic use** 1. In [$CONSOLE][console], click `Timescale project` and save your `Project ID`, then click `Project settings`. 1. Click `Create credentials`, then save `Public key` and `Secret key`. -1. **Configure $COMPANY Terraform provider** +1. **Create a root Pulumi directory** - 1. Create a `main.tf` configuration file with at least the following content. Change `x.y.z` to the [latest version][terraform-provider] of the provider. + For example: - ```hcl - terraform { - required_providers { - timescale = { - source = "timescale/timescale" - version = "x.y.z" - } - } - } - - # Authenticate using client credentials generated in Timescale Console. - # When required, these credentials will change to a short-lived JWT to do the calls. - provider "timescale" { - project_id = var.ts_project_id - access_key = var.ts_access_key - secret_key = var.ts_secret_key - } - - variable "ts_project_id" { - type = string - } - - variable "ts_access_key" { - type = string - } + ```shell + mkdir pulumi-timescale + cd pulumi-timescale + ``` + +1. **Configure Pulumi** + + In the root Pulumi directory, create a `Pulumi.yaml` file and use the programmatic credentials you have created earlier to add the following minimal configuration: + + ```yaml + name: timescale-yaml-project + runtime: yaml + description: A Pulumi project to manage Timescale Cloud resources using YAML + config: + timescale:accessKey: + value: "" + timescale:secretKey: + value: "" + timescale:projectId: + value: "" + aws:region: + value: "us-east-1" + ``` + +1. **Install $COMPANY Terraform provider** - variable "ts_secret_key" { - type = string - } - ``` + ```bash + pulumi package add terraform-provider timescale/timescale + ``` + +1. **Configure your stack** - 1. Create a `terraform.tfvars` file in the same directory as your `main.tf` to pass in the variable values: + Create a `Pulumi.dev.yaml` file and use the programmatic credentials you have created earlier to add the following minimal configuration: - ```hcl - export TF_VAR_ts_project_id="" - export TF_VAR_ts_access_key="" - export TF_VAR_ts_secret_key="" - ``` + ```yaml + config: + timescale:accessKey: "" + timescale:secretKey: "" + timescale:projectId: "" + aws:region: "us-east-1" + ``` 1. **Add your resources** - Add your $SERVICE_LONGs or $VPC connections to the `main.tf` configuration file. For example: - - ```hcl - resource "timescale_service" "test" { - name = "test-service" - milli_cpu = 500 - memory_gb = 2 - region_code = "us-east-1" - enable_ha_replica = false - - timeouts = { - create = "30m" - } - } + Create a `program.yaml` file to define your resources. For example, to create a service: + + ```yaml + resources: + timescaleService: + type: timescale:Service + properties: + name: "example-service" + projectId: "" + password: "secure-password" + regionCode: "us-east-1" + milliCpu: 1000 + memoryGb: 4 + ``` - resource "timescale_vpc" "vpc" { - cidr = "10.10.0.0/16" - name = "test-vpc" - region_code = "us-east-1" - } +1. **Run Pulumi** + + ``` + pulumi up ``` You can now manage your resources with Pulumi. See more about [available resources][terraform-resources] and [data sources][terraform-data-sources]. - [pulumi-install]: https://www.pulumi.com/docs/iac/download-install/ -[terraform]: https://www.terraform.io/ [console]: https://console.cloud.timescale.com/dashboard/services [terraform-provider]: https://registry.terraform.io/providers/timescale/timescale/latest/docs [connection-info]: /use-timescale/:currentVersion:/integrations/find-connection-details/ diff --git a/use-timescale/page-index/page-index.js b/use-timescale/page-index/page-index.js index c17875cb58..74d7ab3c71 100644 --- a/use-timescale/page-index/page-index.js +++ b/use-timescale/page-index/page-index.js @@ -853,6 +853,11 @@ module.exports = [ href: "psql", excerpt: "Connect to Timescale products with psql", }, + { + title: "Pulumi", + href: "pulumi", + excerpt: "Integrate Pulumi with Timescale Cloud", + }, { title: "qStudio", href: "qstudio", From 25307ec03d79834bf8bfcfa62fb34a9d3a4fad25 Mon Sep 17 00:00:00 2001 From: Anagha Mittal Date: Wed, 9 Apr 2025 08:59:53 +0530 Subject: [PATCH 3/3] pulumi integration --- use-timescale/integrations/pulumi.md | 128 +++++++++++++++------------ 1 file changed, 71 insertions(+), 57 deletions(-) diff --git a/use-timescale/integrations/pulumi.md b/use-timescale/integrations/pulumi.md index 68a1f74331..408280741b 100644 --- a/use-timescale/integrations/pulumi.md +++ b/use-timescale/integrations/pulumi.md @@ -2,7 +2,7 @@ title: Integrate Pulumi with Timescale Cloud excerpt: Manage your Timescale Cloud services with a Terraform provider products: [cloud] -keywords: [Terraform, configuration, deployment] +keywords: [Pulumi, Terraform, configuration, deployment] tags: [integrate] --- @@ -20,86 +20,103 @@ This page explains how to configure Pulumi to manage your $SERVICE_LONG or a sel * [Download and install][pulumi-install] Pulumi v1.0 or later. -## Configure Pulumi - -You use the [$COMPANY Terraform provider][terraform-provider] with Pulumi to manage $SERVICE_LONGs: - 1. **Generate client credentials for programmatic use** 1. In [$CONSOLE][console], click `Timescale project` and save your `Project ID`, then click `Project settings`. - 1. Click `Create credentials`, then save `Public key` and `Secret key`. + 2. Click `Create credentials`, then save `Public key` and `Secret key`. -1. **Create a root Pulumi directory** +1. **Initialize a new Pulumi project** - For example: + 1. Create a new directory: - ```shell + ```bash mkdir pulumi-timescale cd pulumi-timescale ``` + 2. Initialize a new Pulumi project using YAML runtime: + + ```bash + pulumi new yaml + ``` + + 3. Set the following fields or use default values as prompted: + `Project name (project): pulumi-timescaledb` + `Project description (A minimal Pulumi YAML program): A Pulumi project to manage Timescale Cloud resources using YAML` + `Stack name (dev): dev` + + Create a password: + `Enter your passphrase to protect config/secrets:` + + You should see something like this: + + ```bash + Created stack 'dev' + + Your new project is ready to go! + + To perform an initial deployment, run `pulumi up` + ``` + 1. **Configure Pulumi** - In the root Pulumi directory, create a `Pulumi.yaml` file and use the programmatic credentials you have created earlier to add the following minimal configuration: + Modify the `Pulumi.yaml` file to this: ```yaml - name: timescale-yaml-project + name: pulumi-timescaledb runtime: yaml - description: A Pulumi project to manage Timescale Cloud resources using YAML + description: Deploy TimescaleDB VPC without AWS + config: - timescale:accessKey: - value: "" - timescale:secretKey: - value: "" - timescale:projectId: - value: "" - aws:region: - value: "us-east-1" + tsProjectId: + type: string + tsAccessKey: + type: string + tsSecretKey: + type: string + tsRegion: + type: string + default: us-east-1 + + resources: + # TimescaleDB VPC + timescaleVpc: + type: timescale:Vpcs + properties: + cidr: "10.10.0.0/16" + name: "timescale-vpc" + regionCode: ${tsRegion} + + outputs: + timescaleVpcId: ${timescaleVpc.vpcsId} + ``` + +1. **Configure the Pulumi stack** + + To configure the stack, use `pulumi-config` along with your saved `Public key`, `Secret key` and `Timescale Project ID`: + + ```bash + pulumi config set tsAccessKey "" --secret + pulumi config set tsSecretKey "" --secret + pulumi config set tsProjectId "" ``` 1. **Install $COMPANY Terraform provider** - + ```bash pulumi package add terraform-provider timescale/timescale ``` - -1. **Configure your stack** - Create a `Pulumi.dev.yaml` file and use the programmatic credentials you have created earlier to add the following minimal configuration: +1. **Run the Pulumi project** - ```yaml - config: - timescale:accessKey: "" - timescale:secretKey: "" - timescale:projectId: "" - aws:region: "us-east-1" - ``` + To view the Timescale VPC, deploy the Pulumi project: -1. **Add your resources** - - Create a `program.yaml` file to define your resources. For example, to create a service: - - ```yaml - resources: - timescaleService: - type: timescale:Service - properties: - name: "example-service" - projectId: "" - password: "secure-password" - regionCode: "us-east-1" - milliCpu: 1000 - memoryGb: 4 - ``` - -1. **Run Pulumi** - - ``` - pulumi up - ``` + ```bash + pulumi up + ``` You can now manage your resources with Pulumi. See more about [available resources][terraform-resources] and [data sources][terraform-data-sources]. @@ -107,8 +124,5 @@ You can now manage your resources with Pulumi. See more about [available resourc [pulumi-install]: https://www.pulumi.com/docs/iac/download-install/ [console]: https://console.cloud.timescale.com/dashboard/services -[terraform-provider]: https://registry.terraform.io/providers/timescale/timescale/latest/docs -[connection-info]: /use-timescale/:currentVersion:/integrations/find-connection-details/ [terraform-resources]: https://registry.terraform.io/providers/timescale/timescale/latest/docs/resources/peering_connection -[terraform-data-sources]: https://registry.terraform.io/providers/timescale/timescale/latest/docs/data-sources/products -[pg-provider]: https://registry.terraform.io/providers/cyrilgdn/postgresql/latest \ No newline at end of file +[terraform-data-sources]: https://registry.terraform.io/providers/timescale/timescale/latest/docs/data-sources/products \ No newline at end of file