Skip to content

Commit

Permalink
Merge pull request #29 from easontm/main
Browse files Browse the repository at this point in the history
Enable startup script
  • Loading branch information
vara-bonthu authored May 10, 2023
2 parents a9997ad + 6936887 commit 89a882f
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 19 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ Apache-2.0 Licensed. See [LICENSE](https://github.com/aws-ia/terraform-aws-mwaa/
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.20.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.63.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.20.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.63.0 |

## Modules

Expand Down Expand Up @@ -146,13 +146,15 @@ No modules.
| <a name="input_plugins_s3_object_version"></a> [plugins\_s3\_object\_version](#input\_plugins\_s3\_object\_version) | (Optional) The plugins.zip file version you want to use. | `string` | `null` | no |
| <a name="input_plugins_s3_path"></a> [plugins\_s3\_path](#input\_plugins\_s3\_path) | (Optional) The relative path to the plugins.zip file on your Amazon S3 storage bucket. For example, plugins.zip. If a relative path is provided in the request, then plugins\_s3\_object\_version is required. | `string` | `null` | no |
| <a name="input_private_subnet_ids"></a> [private\_subnet\_ids](#input\_private\_subnet\_ids) | (Required) The private subnet IDs in which the environment should be created.<br>MWAA requires two subnets. | `list(string)` | n/a | yes |
| <a name="input_requirements_s3_object_version"></a> [requirements\_s3\_object\_version](#input\_requirements\_s3\_object\_version) | Optional) The requirements.txt file version you want to use. | `string` | `null` | no |
| <a name="input_requirements_s3_object_version"></a> [requirements\_s3\_object\_version](#input\_requirements\_s3\_object\_version) | (Optional) The requirements.txt file version you want to use. | `string` | `null` | no |
| <a name="input_requirements_s3_path"></a> [requirements\_s3\_path](#input\_requirements\_s3\_path) | (Optional) The relative path to the requirements.txt file on your Amazon S3 storage bucket. For example, requirements.txt. If a relative path is provided in the request, then requirements\_s3\_object\_version is required. | `string` | `null` | no |
| <a name="input_schedulers"></a> [schedulers](#input\_schedulers) | (Optional) The number of schedulers that you want to run in your environment. | `string` | `null` | no |
| <a name="input_security_group_ids"></a> [security\_group\_ids](#input\_security\_group\_ids) | Security group IDs for MWAA | `list(string)` | `[]` | no |
| <a name="input_source_bucket_arn"></a> [source\_bucket\_arn](#input\_source\_bucket\_arn) | (Required) The Amazon Resource Name (ARN) of your Amazon S3 storage bucket. For example, arn:aws:s3:::airflow-mybucketname | `string` | `null` | no |
| <a name="input_source_bucket_name"></a> [source\_bucket\_name](#input\_source\_bucket\_name) | New bucket will be created with the given name for MWAA when create\_s3\_bucket=true | `string` | `null` | no |
| <a name="input_source_cidr"></a> [source\_cidr](#input\_source\_cidr) | (Required) Source CIDR block which will be allowed on MWAA SG to access Airflow UI<br>Used only if `create_security_group=true` | `list(string)` | `[]` | no |
| <a name="input_startup_script_s3_object_version"></a> [startup\_script\_s3\_object\_version](#input\_startup\_script\_s3\_object\_version) | (Optional) The version of the startup shell script you want to use. You must specify the version ID that Amazon S3 assigns to the file every time you update the script. | `string` | `null` | no |
| <a name="input_startup_script_s3_path"></a> [startup\_script\_s3\_path](#input\_startup\_script\_s3\_path) | (Optional) The relative path to the script hosted in your bucket. The script runs as your environment starts before starting the Apache Airflow process. Use this script to install dependencies, modify configuration options, and set environment variables. | `string` | `null` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | (Optional) A map of resource tags to associate with the resource | `map(string)` | `{}` | no |
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | (Required) VPC ID to deploy the MWAA Environment.<br>Mandatory if `create_security_group=true` | `string` | `""` | no |
| <a name="input_webserver_access_mode"></a> [webserver\_access\_mode](#input\_webserver\_access\_mode) | (Optional) Specifies whether the webserver should be accessible over the internet or via your specified VPC. Possible options: PRIVATE\_ONLY (default) and PUBLIC\_ONLY | `string` | `"PRIVATE_ONLY"` | no |
Expand Down
18 changes: 10 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ resource "aws_mwaa_environment" "mwaa" {
max_workers = var.max_workers
kms_key = var.kms_key

dag_s3_path = var.dag_s3_path
plugins_s3_object_version = var.plugins_s3_object_version
plugins_s3_path = var.plugins_s3_path
requirements_s3_path = var.requirements_s3_path
requirements_s3_object_version = var.requirements_s3_object_version
schedulers = var.schedulers
execution_role_arn = local.execution_role_arn
airflow_configuration_options = local.airflow_configuration_options
dag_s3_path = var.dag_s3_path
plugins_s3_object_version = var.plugins_s3_object_version
plugins_s3_path = var.plugins_s3_path
requirements_s3_path = var.requirements_s3_path
requirements_s3_object_version = var.requirements_s3_object_version
startup_script_s3_path = var.startup_script_s3_path
startup_script_s3_object_version = var.startup_script_s3_object_version
schedulers = var.schedulers
execution_role_arn = local.execution_role_arn
airflow_configuration_options = local.airflow_configuration_options

source_bucket_arn = local.source_bucket_arn
webserver_access_mode = var.webserver_access_mode
Expand Down
26 changes: 19 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ variable "min_workers" {
}

variable "plugins_s3_object_version" {
description = " (Optional) The plugins.zip file version you want to use."
description = "(Optional) The plugins.zip file version you want to use."
type = string
default = null
}
Expand All @@ -90,12 +90,30 @@ variable "plugins_s3_path" {
default = null
}

variable "requirements_s3_object_version" {
description = "(Optional) The requirements.txt file version you want to use."
type = string
default = null
}

variable "requirements_s3_path" {
description = "(Optional) The relative path to the requirements.txt file on your Amazon S3 storage bucket. For example, requirements.txt. If a relative path is provided in the request, then requirements_s3_object_version is required."
type = string
default = null
}

variable "startup_script_s3_object_version" {
description = "(Optional) The version of the startup shell script you want to use. You must specify the version ID that Amazon S3 assigns to the file every time you update the script."
type = string
default = null
}

variable "startup_script_s3_path" {
description = "(Optional) The relative path to the script hosted in your bucket. The script runs as your environment starts before starting the Apache Airflow process. Use this script to install dependencies, modify configuration options, and set environment variables."
type = string
default = null
}

variable "schedulers" {
description = "(Optional) The number of schedulers that you want to run in your environment."
type = string
Expand Down Expand Up @@ -226,9 +244,3 @@ variable "source_cidr" {
type = list(string)
default = []
}

variable "requirements_s3_object_version" {
description = "Optional) The requirements.txt file version you want to use."
type = string
default = null
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.20.0"
version = ">= 4.63.0"
}
}
}

0 comments on commit 89a882f

Please sign in to comment.