Skip to content

Commit

Permalink
Merge pull request #1 from data-platform-hq/added_module
Browse files Browse the repository at this point in the history
feat: added module
  • Loading branch information
ivasm-ko authored Jan 20, 2023
2 parents fb7b0a2 + a02006b commit 0ae8f9d
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 3 deletions.
48 changes: 45 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,54 @@
# Google <> Terraform module
Terraform module for creation Google <>
# Google Composer Environments Terraform module
Terraform module for creation Google Composer Environments

## Usage

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
| ------------------------------------------------------------------------- | --------- |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
| <a name="requirement_google"></a> [google](#requirement\_google) | >= 4.24.0 |

## Providers

| Name | Version |
| ---------------------------------------------------------------- | --------- |
| <a name="requirement_google"></a> [google](#requirement\_google) | >= 4.24.0 |

## Modules

No modules.

## Resources

| Name | Type |
| --------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| [google_composer_environment.main](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/composer_environment) | resource |

## Inputs

| Name | Description | Type | Default | Required |
| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------- | :------: |
| <a name="input_product_base_name"></a> [product\_base\_name](#input\_product\_base\_name) | Cloud resources base name (used to create services) | `string` | n/a | yes |
| <a name="input_env"></a> [env](#input\_env) | Variable to mark the environment of the resource (used to create services) | `string` | n/a | yes |
| <a name="input_network"></a> [network](#input\_network) | The Compute Engine network to be used for machine communications | `string` | n/a | yes |
| <a name="input_subnet"></a> [subnet](#input\_subnet) | The Compute Engine subnetwork to be used for machine communications | `string` | n/a | yes |
| <a name="input_sa_email"></a> [sa_email](#input\_sa_email) | The Google Cloud Platform Service Account to be used by the node VMs | `string` | n/a | yes |
| <a name="input_image_version"></a> [image\_version](#input\_image\_version) | The version of the software running in the environment | `string` | "composer-2.0.22-airflow-2.2.5" | no |
| <a name="input_environment_size"></a> [environment\_size](#input\_environment\_size) | The environment size controls the performance parameters of the managed Cloud Composer infrastructure that includes the Airflow database | `string` | "ENVIRONMENT_SIZE_SMALL" | no |
| <a name="input_enable_private_endpoint"></a> [enable\_private\_endpoint](#input\_enable\_private\_endpoint) | If true, access to the public endpoint of the GKE cluster is denied | `bool` | true | no |
| <a name="input_labels"></a> [labels](#input\_labels) | The labels associated with this dataset. You can use these to organize and group your datasets | `bool` | true | no |

## Outputs

| Name | Description |
| ----------------------------------------------------------------------- | ------------------------------------------------------------------- |
| <a name="output_airflow_url"></a> [airflow\_url](#output\_airflow\_url) | The URI of the Apache Airflow Web UI hosted within the environment. |
| <a name="output_dags_bucket"></a> [dags\_bucket](#output\_dags\_bucket) | The Cloud Storage prefix of the DAGs for the environment. |
<!-- END_TF_DOCS -->

## License

Apache 2 Licensed. For more information please see [LICENSE](https://github.com/data-platform-hq/terraform-azurerm<>/tree/master/LICENSE)
Apache 2 Licensed. For more information please see [LICENSE](https://github.com/data-platform-hq/terraform-google-composer-env/blob/main/LICENSE)
19 changes: 19 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "google_composer_environment" "main" {
name = "${var.env}-${var.product_base_name}-composer"
config {
software_config {
image_version = var.image_version
}
environment_size = var.environment_size
node_config {
network = var.network
subnetwork = var.subnet
service_account = var.sa_email
}
private_environment_config {
enable_private_endpoint = var.enable_private_endpoint
}
}

labels = var.labels
}
9 changes: 9 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
output "airflow_url" {
description = " The URI of the Apache Airflow Web UI hosted within this environment."
value = google_composer_environment.main.config[0].airflow_uri
}

output "dags_bucket" {
description = "The Cloud Storage prefix of the DAGs for this environment."
value = google_composer_environment.main.config[0].dag_gcs_prefix
}
48 changes: 48 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
variable "product_base_name" {
description = "Cloud resources base name (used to create services)."
type = string
}

variable "env" {
description = "Variable to mark the environment of the resource (used to create services)."
type = string
}

variable "network" {
description = "The Compute Engine network to be used for machine communications."
type = string
}

variable "subnet" {
description = "The Compute Engine subnetwork to be used for machine communications."
type = string
}

variable "sa_email" {
description = "The Google Cloud Platform Service Account to be used by the node VMs."
type = string
}

variable "image_version" {
description = "The version of the software running in the environment."
type = string
default = "composer-2.0.22-airflow-2.2.5"
}

variable "environment_size" {
description = "The environment size controls the performance parameters of the managed Cloud Composer infrastructure that includes the Airflow database."
type = string
default = "ENVIRONMENT_SIZE_SMALL"
}

variable "enable_private_endpoint" {
description = "If true, access to the public endpoint of the GKE cluster is denied."
type = bool
default = true
}

variable "labels" {
description = "The labels associated with this dataset. You can use these to organize and group your datasets."
type = map(string)
default = {}
}
9 changes: 9 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
required_version = ">= 1.0.0"
required_providers {
google = {
source = "hashicorp/google"
version = "4.24.0"
}
}
}

0 comments on commit 0ae8f9d

Please sign in to comment.