From edeb3e9b22f29c36cf5b8e35f8c5258e03f24d80 Mon Sep 17 00:00:00 2001 From: Balazs Gaspar Date: Tue, 19 Sep 2023 11:50:52 +0100 Subject: [PATCH 1/3] Update README.md with instructions for local environment setup --- README.md | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/README.md b/README.md index 67b60b3..ec8b10c 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,93 @@ If you no longer need the infrastructure that’s provisioned by the Terraform m terraform destroy ``` +## Set up a Local Development Environment + +As mentioned in the Usage section of this readme, the [cdp-tf-quickstarts](https://github.com/cloudera-labs/cdp-tf-quickstarts) repository demonstrates how to deploy CDP end-to-end in a simplified way, using the modules in this repository. If you would like to customize your setup however, you may want to change some of the module code. To make sure you can test your changes locally and create customized deployments, we recommend the following setup: + +1. Create a directory called `tf` and clone the Quickstart module repository +```bash +mkdir tf +cd tf +git clone https://github.com/cloudera-labs/cdp-tf-quickstarts.git +``` +This will result in the directory structure below: +```bash +tree -L 4 +. +└── tf + └── cdp-tf-quickstarts + ├── LICENSE + ├── README.md + ├── aws + │ ├── main.tf + │ ├── terraform.tfvars.template + │ └── variables.tf + └── azure + ├── main.tf + ├── terraform.tfvars.template + └── variables.tf +``` +The cdp-tf-quickstarts module consists of these few files only. This is achieved by loading the required submodules dynamically in the `main.tf` file: +```bash +module "cdp_aws_prereqs" { + source = "git::https://github.com/cloudera-labs/terraform-cdp-modules.git//modules/terraform-cdp-aws-pre-reqs?ref=v0.1.0" + … +} +``` + +2. For a local development environment these modules should be present locally. Make sure we are in the same project folder as earlier and clone this repository +```bash +cd ~/tf +git clone https://github.com/cloudera-labs/terraform-cdp-modules.git +``` +This will result in the following directory structure with the two cloned repositories: +```bash +cd ~ +tree -L 4 +. +└── tf + ├── cdp-tf-quickstarts + │ ├── LICENSE + │ ├── README.md + │ ├── aws + │ │ ├── main.tf + │ │ ├── terraform.tfvars.template + │ │ └── variables.tf + │ └── azure + │ ├── main.tf + │ ├── terraform.tfvars.template + │ └── variables.tf + └── terraform-cdp-modules + ├── LICENSE + ├── README.md + └── modules + ├── terraform-cdp-aws-pre-reqs + ├── terraform-cdp-azure-pre-reqs + └── terraform-cdp-deploy +``` + +3. The last step for setting up the local cdependencies is to link the two modules. To do this, simply edit the two main.tf files of the cdp-tf-quickstarts module. + +#### AWS +```bash +vi ~/tf/cdp-tf-quickstarts/aws/main.tf + +# Change the first line of code in both “module” blocks: + +# from +source = "git::https://github.com/cloudera-labs/terraform-cdp-modules.git//modules/terraform-cdp-aws-pre-reqs?ref=v0.2.0" +# to +source = "../../terraform-cdp-modules/modules/terraform-cdp-aws-pre-reqs" +# and from +source = "git::https://github.com/cloudera-labs/terraform-cdp-modules.git//modules/terraform-cdp-deploy?ref=v0.2.0" +# to +source = "../../terraform-cdp-modules/modules/terraform-cdp-deploy" +``` + +#### Azure +Same as above, just change the first module’s source to `source = "../../terraform-cdp-modules/modules/terraform-cdp-azure-pre-reqs"` + ## Dependencies To set up CDP via deployment automation using this guide, the following dependencies must be installed in your local environment: From 03ffa16335225a3cc48fa56e2a2521f5607136d5 Mon Sep 17 00:00:00 2001 From: Jim Enright Date: Tue, 19 Sep 2023 11:59:14 +0100 Subject: [PATCH 2/3] Move local dev environment steps to DEVELOPMENT.md Signed-off-by: Jim Enright --- DEVELOPMENT.md | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 87 --------------------------------------------- 2 files changed, 95 insertions(+), 87 deletions(-) create mode 100644 DEVELOPMENT.md diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..d697200 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,95 @@ +# Set up a Local Development Environment + +As mentioned in the Usage section of the readme, the [cdp-tf-quickstarts](https://github.com/cloudera-labs/cdp-tf-quickstarts) repository demonstrates how to deploy CDP end-to-end in a simplified way, using the modules in this repository. If you would like to customize your setup however, you may want to change some of the module code. To make sure you can test your changes locally and create customized deployments, we recommend the following setup: + +1. Create a directory called `tf` and clone the Quickstart module repository + +```bash +mkdir tf +cd tf +git clone https://github.com/cloudera-labs/cdp-tf-quickstarts.git +``` + +This will result in the directory structure below: + +```bash +tree -L 4 +. +└── tf + └── cdp-tf-quickstarts + ├── LICENSE + ├── README.md + ├── aws + │ ├── main.tf + │ ├── terraform.tfvars.template + │ └── variables.tf + └── azure + ├── main.tf + ├── terraform.tfvars.template + └── variables.tf +``` + +The cdp-tf-quickstarts module consists of these few files only. This is achieved by loading the required submodules dynamically in the `main.tf` file: + +```bash +module "cdp_aws_prereqs" { + source = "git::https://github.com/cloudera-labs/terraform-cdp-modules.git//modules/terraform-cdp-aws-pre-reqs?ref=v0.1.0" + … +} +``` + +2. For a local development environment these modules should be present locally. Make sure we are in the same project folder as earlier and clone this repository + +```bash +cd ~/tf +git clone https://github.com/cloudera-labs/terraform-cdp-modules.git +``` + +This will result in the following directory structure with the two cloned repositories: + +```bash +cd ~ +tree -L 4 +. +└── tf + ├── cdp-tf-quickstarts + │ ├── LICENSE + │ ├── README.md + │ ├── aws + │ │ ├── main.tf + │ │ ├── terraform.tfvars.template + │ │ └── variables.tf + │ └── azure + │ ├── main.tf + │ ├── terraform.tfvars.template + │ └── variables.tf + └── terraform-cdp-modules + ├── LICENSE + ├── README.md + └── modules + ├── terraform-cdp-aws-pre-reqs + ├── terraform-cdp-azure-pre-reqs + └── terraform-cdp-deploy +``` + +3. The last step for setting up the local cdependencies is to link the two modules. To do this, simply edit the two main.tf files of the cdp-tf-quickstarts module. + +## AWS + +```bash +vi ~/tf/cdp-tf-quickstarts/aws/main.tf + +# Change the first line of code in both "module" blocks: + +# from +source = "git::https://github.com/cloudera-labs/terraform-cdp-modules.git//modules/terraform-cdp-aws-pre-reqs?ref=v0.2.0" +# to +source = "../../terraform-cdp-modules/modules/terraform-cdp-aws-pre-reqs" +# and from +source = "git::https://github.com/cloudera-labs/terraform-cdp-modules.git//modules/terraform-cdp-deploy?ref=v0.2.0" +# to +source = "../../terraform-cdp-modules/modules/terraform-cdp-deploy" +``` + +#### Azure +Same as above, just change the first module’s source to `source = "../../terraform-cdp-modules/modules/terraform-cdp-azure-pre-reqs"` diff --git a/README.md b/README.md index ec8b10c..67b60b3 100644 --- a/README.md +++ b/README.md @@ -54,93 +54,6 @@ If you no longer need the infrastructure that’s provisioned by the Terraform m terraform destroy ``` -## Set up a Local Development Environment - -As mentioned in the Usage section of this readme, the [cdp-tf-quickstarts](https://github.com/cloudera-labs/cdp-tf-quickstarts) repository demonstrates how to deploy CDP end-to-end in a simplified way, using the modules in this repository. If you would like to customize your setup however, you may want to change some of the module code. To make sure you can test your changes locally and create customized deployments, we recommend the following setup: - -1. Create a directory called `tf` and clone the Quickstart module repository -```bash -mkdir tf -cd tf -git clone https://github.com/cloudera-labs/cdp-tf-quickstarts.git -``` -This will result in the directory structure below: -```bash -tree -L 4 -. -└── tf - └── cdp-tf-quickstarts - ├── LICENSE - ├── README.md - ├── aws - │ ├── main.tf - │ ├── terraform.tfvars.template - │ └── variables.tf - └── azure - ├── main.tf - ├── terraform.tfvars.template - └── variables.tf -``` -The cdp-tf-quickstarts module consists of these few files only. This is achieved by loading the required submodules dynamically in the `main.tf` file: -```bash -module "cdp_aws_prereqs" { - source = "git::https://github.com/cloudera-labs/terraform-cdp-modules.git//modules/terraform-cdp-aws-pre-reqs?ref=v0.1.0" - … -} -``` - -2. For a local development environment these modules should be present locally. Make sure we are in the same project folder as earlier and clone this repository -```bash -cd ~/tf -git clone https://github.com/cloudera-labs/terraform-cdp-modules.git -``` -This will result in the following directory structure with the two cloned repositories: -```bash -cd ~ -tree -L 4 -. -└── tf - ├── cdp-tf-quickstarts - │ ├── LICENSE - │ ├── README.md - │ ├── aws - │ │ ├── main.tf - │ │ ├── terraform.tfvars.template - │ │ └── variables.tf - │ └── azure - │ ├── main.tf - │ ├── terraform.tfvars.template - │ └── variables.tf - └── terraform-cdp-modules - ├── LICENSE - ├── README.md - └── modules - ├── terraform-cdp-aws-pre-reqs - ├── terraform-cdp-azure-pre-reqs - └── terraform-cdp-deploy -``` - -3. The last step for setting up the local cdependencies is to link the two modules. To do this, simply edit the two main.tf files of the cdp-tf-quickstarts module. - -#### AWS -```bash -vi ~/tf/cdp-tf-quickstarts/aws/main.tf - -# Change the first line of code in both “module” blocks: - -# from -source = "git::https://github.com/cloudera-labs/terraform-cdp-modules.git//modules/terraform-cdp-aws-pre-reqs?ref=v0.2.0" -# to -source = "../../terraform-cdp-modules/modules/terraform-cdp-aws-pre-reqs" -# and from -source = "git::https://github.com/cloudera-labs/terraform-cdp-modules.git//modules/terraform-cdp-deploy?ref=v0.2.0" -# to -source = "../../terraform-cdp-modules/modules/terraform-cdp-deploy" -``` - -#### Azure -Same as above, just change the first module’s source to `source = "../../terraform-cdp-modules/modules/terraform-cdp-azure-pre-reqs"` - ## Dependencies To set up CDP via deployment automation using this guide, the following dependencies must be installed in your local environment: From 8330c620846104d24a63bfb54bfb264157cf0897 Mon Sep 17 00:00:00 2001 From: Jim Enright Date: Tue, 19 Sep 2023 15:12:29 +0100 Subject: [PATCH 3/3] Add link to dev env docs in README Signed-off-by: Jim Enright --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 67b60b3..0353726 100644 --- a/README.md +++ b/README.md @@ -68,3 +68,7 @@ Configure Terraform Provider for AWS or Azure * To create resources in the Cloud Provider, access credentials or service account are needed for authentication. * For **AWS** access keys are required to be able to create the Cloud resources via the Terraform aws provider. See the [AWS Terraform Provider Documentation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration). * For **Azure**, authentication with the Azure subscription is required. There are a number of ways to do this outlined in the [Azure Terraform Provider Documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#authenticating-to-azure). + +## Local Development Environment + +See the [DEVELOPMENT.md](./DEVELOPMENT.md) file for instructions on how to set up an environment for local development of modules. \ No newline at end of file