-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(daft): read delta table (#24848)
- Loading branch information
1 parent
200768a
commit 21183da
Showing
27 changed files
with
597 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
cloud-infrastructure/terraform/modules/kubernetes/hm_prefect_worker_iam_role/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
terraform { | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
} | ||
} | ||
} | ||
|
||
data "aws_caller_identity" "current" {} | ||
data "aws_region" "current" {} | ||
|
||
locals { | ||
aws_iam_role_name_prefix = "PrefectWorkerRole" | ||
} | ||
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role | ||
resource "aws_iam_role" "prefect_worker_iam_role" { | ||
name = "${local.aws_iam_role_name_prefix}-${var.prefect_worker_service_account_name}" | ||
assume_role_policy = jsonencode({ | ||
Version = "2012-10-17" | ||
Statement = [ | ||
{ | ||
Effect = "Allow" | ||
Principal = { | ||
Federated = var.amazon_eks_cluster_oidc_provider_arn | ||
} | ||
Action = "sts:AssumeRoleWithWebIdentity" | ||
Condition = { | ||
StringEquals = { | ||
"${var.amazon_eks_cluster_oidc_provider}:aud" = "sts.amazonaws.com", | ||
"${var.amazon_eks_cluster_oidc_provider}:sub" = "system:serviceaccount:${var.prefect_worker_namespace}:${var.prefect_worker_service_account_name}" | ||
} | ||
} | ||
} | ||
] | ||
}) | ||
tags = { | ||
Environment = var.environment | ||
Team = var.team | ||
Name = "${local.aws_iam_role_name_prefix}-${var.prefect_worker_service_account_name}" | ||
} | ||
} | ||
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy | ||
resource "aws_iam_role_policy" "iot_data_s3_policy" { | ||
name = "${local.aws_iam_role_name_prefix}IotDataS3Policy-${var.prefect_worker_service_account_name}" | ||
role = aws_iam_role.prefect_worker_iam_role.name | ||
policy = jsonencode({ | ||
Version = "2012-10-17" | ||
Statement = [ | ||
{ | ||
Effect = "Allow" | ||
Action = [ | ||
"s3:GetBucketLocation", | ||
"s3:ListBucket" | ||
] | ||
Resource = [ | ||
"arn:aws:s3:::${var.iot_data_s3_bucket_name}" | ||
] | ||
}, | ||
{ | ||
Effect = "Allow" | ||
Action = [ | ||
"s3:GetObject", | ||
"s3:PutObject" | ||
] | ||
Resource = [ | ||
"arn:aws:s3:::${var.iot_data_s3_bucket_name}/*" | ||
] | ||
} | ||
] | ||
}) | ||
} | ||
# https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy | ||
resource "aws_iam_role_policy" "aws_glue_policy" { | ||
name = "${local.aws_iam_role_name_prefix}AwsGluePolicy-${var.prefect_worker_service_account_name}" | ||
role = aws_iam_role.prefect_worker_iam_role.name | ||
policy = jsonencode({ | ||
Version = "2012-10-17" | ||
Statement = [ | ||
{ | ||
Effect = "Allow" | ||
Action = [ | ||
"glue:GetDatabase", | ||
"glue:GetDatabases", | ||
"glue:GetTable", | ||
"glue:GetTables" | ||
] | ||
Resource = flatten([ | ||
"arn:aws:glue:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:catalog", | ||
[for database in var.aws_glue_database_names : | ||
"arn:aws:glue:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:database/${database}" | ||
], | ||
[for database in var.aws_glue_database_names : | ||
"arn:aws:glue:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:table/${database}/*" | ||
] | ||
]) | ||
} | ||
] | ||
}) | ||
} |
24 changes: 24 additions & 0 deletions
24
cloud-infrastructure/terraform/modules/kubernetes/hm_prefect_worker_iam_role/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
variable "prefect_worker_service_account_name" { | ||
type = string | ||
} | ||
variable "prefect_worker_namespace" { | ||
type = string | ||
} | ||
variable "iot_data_s3_bucket_name" { | ||
type = string | ||
} | ||
variable "aws_glue_database_names" { | ||
type = list(string) | ||
} | ||
variable "amazon_eks_cluster_oidc_provider" { | ||
type = string | ||
} | ||
variable "amazon_eks_cluster_oidc_provider_arn" { | ||
type = string | ||
} | ||
variable "environment" { | ||
type = string | ||
} | ||
variable "team" { | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
data-orchestration/hm-prefect/workflows/calculate/.prefectignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.