2021-06-05 07:05:39 -07:00
# Data Platform Foundations - Environment (Step 1)
2021-05-18 09:30:21 -07:00
2021-06-05 07:05:39 -07:00
This is the first step needed to deploy Data Platform Foundations, which creates projects and service accounts. Please refer to the [top-level Data Platform README ](../README.md ) for prerequisites.
2021-05-18 09:30:21 -07:00
2021-06-05 07:05:39 -07:00
The projects that will be created are:
2021-05-18 09:30:21 -07:00
- Common services
- Landing
- Orchestration & Transformation
- DWH
- Datamart
2021-06-10 08:04:27 -07:00
A main service account named `projects-editor-sa` will be created under the common services project, and it will be granted editor permissions on all the projects in scope.
This is a high level diagram of the created resources:
2021-06-11 01:15:04 -07:00
![Environment - Phase 1 ](./diagram.png "High-level Environment diagram" )
2021-05-18 09:30:21 -07:00
## Running the example
To create the infrastructure:
2021-06-05 07:05:39 -07:00
- specify your variables in a `terraform.tvars`
2021-05-18 09:30:21 -07:00
```tfm
2021-06-05 07:05:39 -07:00
billing_account = "1234-1234-1234"
parent = "folders/12345678"
2021-05-18 09:30:21 -07:00
```
2021-06-05 07:05:39 -07:00
- make sure you have the right authentication setup (application default credentials, or a service account key)
2021-06-15 08:13:40 -07:00
- **The output of this stage contains the values for the resources stage**
2021-06-05 07:05:39 -07:00
- run `terraform init` and `terraform apply`
2021-05-18 09:30:21 -07:00
2021-06-10 08:04:27 -07:00
Once done testing, you can clean up resources by running `terraform destroy` .
2021-05-18 09:30:21 -07:00
<!-- BEGIN TFDOC -->
2021-06-05 07:05:39 -07:00
## Variables
2021-05-23 03:46:47 -07:00
2021-06-05 07:05:39 -07:00
| name | description | type | required | default |
|---|---|:---: |:---:|:---:|
| billing_account_id | Billing account id. | < code title = "" > string< / code > | ✓ | |
| root_node | Parent folder or organization in 'folders/folder_id' or 'organizations/org_id' format. | < code title = "" > string< / code > | ✓ | |
| *prefix* | Prefix used to generate project id and name. | < code title = "" > string</ code > | | < code title = "" > null</ code > |
| *project_names* | Override this variable if you need non-standard names. | < code title = "object({ datamart = string dwh = string landing = string services = string transformation = string })" > object({...})</ code > | | < code title = "{ datamart = "datamart" dwh = "datawh" landing = "landing" services = "services" transformation = "transformation" }" > ...</ code > |
| *service_account_names* | Override this variable if you need non-standard names. | < code title = "object({ main = string })" > object({...})</ code > | | < code title = "{ main = "data-platform-main" }" > ...</ code > |
2021-05-18 09:30:21 -07:00
## Outputs
2021-06-05 07:05:39 -07:00
| name | description | sensitive |
|---|---|:---:|
| project_ids | Project ids for created projects. | |
2021-06-10 08:04:27 -07:00
| service_account | Main service account. | |
2021-05-18 09:30:21 -07:00
<!-- END TFDOC -->