Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DQ-175 fix athena connection lifecycle null resource #115

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions terraform/modules/athena-connector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ No modules.
| [aws_s3_bucket_public_access_block.public_access_block](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
| [aws_s3_bucket_versioning.athena_spill_bucket](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_versioning) | resource |
| [null_resource.athena_dynamodb_connector](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
| [null_resource.delete_athena_dynamodb_connector](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_data_catalog_name"></a> [data\_catalog\_name](#input\_data\_catalog\_name) | Name of athena data catalog | `string` | n/a | yes |
| <a name="input_delete_athena_dynamodb_connector"></a> [delete\_athena\_dynamodb\_connector](#input\_delete\_athena\_dynamodb\_connector) | Set to True to delete athena dynamodb connector | `bool` | `false` | no |
| <a name="input_primary_aws_region"></a> [primary\_aws\_region](#input\_primary\_aws\_region) | AWS region | `string` | n/a | yes |
| <a name="input_vpc_security_group_ids"></a> [vpc\_security\_group\_ids](#input\_vpc\_security\_group\_ids) | List of security group assigned to lambda. If null value, default subnet and vpc will be used | `list(string)` | `null` | no |
| <a name="input_vpc_subnet_ids"></a> [vpc\_subnet\_ids](#input\_vpc\_subnet\_ids) | List of subnet ids to place lambda in. If null value, default subnet and vpc will be used | `list(string)` | `null` | no |
Expand Down
9 changes: 3 additions & 6 deletions terraform/modules/athena-connector/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,14 @@ resource "aws_lambda_function" "athena_dynamodb_connector" {

resource "null_resource" "athena_dynamodb_connector" {
provisioner "local-exec" {
when = create
command = "aws athena create-data-catalog --name ${var.data_catalog_name} --type LAMBDA --region ${var.primary_aws_region} --parameters function=${aws_lambda_function.athena_dynamodb_connector.arn}"
}

depends_on = [aws_lambda_function.athena_dynamodb_connector]
}

resource "null_resource" "delete_athena_dynamodb_connector" {
count = var.delete_athena_dynamodb_connector ? 1 : 0
provisioner "local-exec" {
when = destroy
command = "aws athena delete-data-catalog --name ${var.data_catalog_name} --region ${var.primary_aws_region}"
}

depends_on = [null_resource.athena_dynamodb_connector]
depends_on = [aws_lambda_function.athena_dynamodb_connector]
}
6 changes: 0 additions & 6 deletions terraform/modules/athena-connector/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ variable "primary_aws_region" {
type = string
}

variable "delete_athena_dynamodb_connector" {
description = "Set to True to delete athena dynamodb connector"
type = bool
default = false
}

variable "vpc_subnet_ids" {
description = "List of subnet ids to place lambda in. If null value, default subnet and vpc will be used"
type = list(string)
Expand Down
Loading