Skip to content

Commit

Permalink
chore(terraform): set aws provider (#18020)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongbo-miao authored Jul 14, 2024
1 parent 4657336 commit 52f4ba5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ module "hm_amazon_msk_cluster" {
}
# Tracker Kafka - Kafka sink plugin
data "external" "hm_local_tracker_sink_plugin" {
program = ["bash", "files/amazon-msk/${var.environment}-tracker-kafka/plugins/build.sh"]
provider = aws.production
program = ["bash", "files/amazon-msk/${var.environment}-tracker-kafka/plugins/build.sh"]
query = {
kafka_plugin_name = local.tracker_kafka_sink_plugin_name
snowflake_kafka_connector_version = "2.2.2" # https://mvnrepository.com/artifact/com.snowflake/snowflake-kafka-connector
Expand Down Expand Up @@ -104,9 +105,11 @@ module "hm_amazon_msk_tracker_sink_connector_iam" {
team = var.team
}
data "aws_secretsmanager_secret" "tracker_snowflake_secret" {
name = "hm/snowflake/production_hm_kafka_db/product/read_write"
provider = aws.production
name = "hm/snowflake/production_hm_kafka_db/product/read_write"
}
data "aws_secretsmanager_secret_version" "tracker_snowflake_secret_version" {
provider = aws.production
secret_id = data.aws_secretsmanager_secret.tracker_snowflake_secret.id
}
module "hm_amazon_msk_tracker_sink_connector" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ module "hm_amazon_ec2" {
# Amazon EMR
# Amazon EMR - Trino
data "aws_secretsmanager_secret" "hm_rds_secret" {
name = "hm/amazon-rds/production_hm_iot_db/public/read_only"
provider = aws.production
name = "hm/amazon-rds/production_hm_iot_db/public/read_only"
}
data "aws_secretsmanager_secret_version" "hm_rds_secret_version" {
provider = aws.production
secret_id = data.aws_secretsmanager_secret.hm_rds_secret.id
}
locals {
Expand Down Expand Up @@ -144,6 +146,7 @@ module "hm_trino_task_instance_fleet" {
]
}
data "aws_instance" "hm_trino_primary_node_ec2_instance" {
provider = aws.production
filter {
name = "private-dns-name"
values = [module.hm_trino_emr.master_public_dns]
Expand All @@ -164,20 +167,6 @@ module "s3_object_hm_sedona_set_up_script" {
s3_key = "amazon-emr/clusters/hm-amazon-emr-cluster-sedona/bootstrap-actions/set_up.sh"
local_file_path = "files/amazon-emr/hm-amazon-emr-cluster-sedona/bootstrap-actions/set_up.sh"
}
module "s3_object_hm_sedona_validate_python_version_script" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_s3_object"
s3_bucket_name = data.terraform_remote_state.hm_terraform_remote_state_production_aws_data.outputs.production_hm_production_bucket_amazon_s3_bucket_name
s3_key = "amazon-emr/clusters/hm-amazon-emr-cluster-sedona/steps/validate_python_version.py"
local_file_path = "files/amazon-emr/hm-amazon-emr-cluster-sedona/steps/validate_python_version.py"
}
module "s3_object_hm_sedona_set_up_jupyterlab_script" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_s3_object"
s3_bucket_name = data.terraform_remote_state.hm_terraform_remote_state_production_aws_data.outputs.production_hm_production_bucket_amazon_s3_bucket_name
s3_key = "amazon-emr/clusters/hm-amazon-emr-cluster-sedona/steps/set_up_jupyterlab.sh"
local_file_path = "files/amazon-emr/hm-amazon-emr-cluster-sedona/steps/set_up_jupyterlab.sh"
}
module "hm_sedona_cluster" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_emr_cluster"
Expand Down Expand Up @@ -255,6 +244,7 @@ module "hm_sedona_cluster_managed_scaling_policy" {
max_capacity_units = 60
}
data "aws_instance" "hm_sedona_cluster_primary_node" {
provider = aws.production
filter {
name = "private-dns-name"
values = [module.hm_sedona_cluster.master_public_dns]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module "hm_amazon_eks_access_entry_iam" {
}
# https://registry.terraform.io/modules/terraform-aws-modules/eks/aws/latest
module "hm_amazon_eks_cluster" {
providers = { aws = aws.production }
source = "terraform-aws-modules/eks/aws"
version = "20.17.2"
cluster_name = local.amazon_eks_cluster_name
Expand Down Expand Up @@ -138,6 +139,7 @@ module "karpenter" {

# Amazon EBS CSI Driver - IAM role
module "hm_amazon_ebs_csi_driver_iam_role" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_ebs_csi_driver_iam_role"
amazon_eks_cluster_name = module.hm_amazon_eks_cluster.cluster_name
amazon_eks_cluster_oidc_provider = module.hm_amazon_eks_cluster.oidc_provider
Expand Down Expand Up @@ -203,6 +205,7 @@ module "hm_kubernetes_namespace_hm_traefik" {
# ExternalDNS
# ExternalDNS - IAM role
module "hm_external_dns_iam_role" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_external_dns_iam_role"
external_dns_service_account_name = "hm-external-dns"
external_dns_namespace = "${var.environment}-hm-external-dns"
Expand All @@ -227,6 +230,7 @@ module "hm_kubernetes_namespace_hm_external_dns" {
# cert-manager
# cert-manager - IAM role
module "hm_cert_manager_iam_role" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_cert_manager_iam_role"
cert_manager_service_account_name = "hm-cert-manager"
cert_manager_namespace = "${var.environment}-hm-cert-manager"
Expand All @@ -252,13 +256,15 @@ module "hm_kubernetes_namespace_hm_cert_manager" {
# Airbyte
# Airbyte - S3 bucket
module "hm_amazon_s3_bucket_hm_airbyte" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_s3_bucket"
s3_bucket_name = "${var.environment}-hm-airbyte"
environment = var.environment
team = var.team
}
# Airbyte - IAM user
module "hm_airbyte_iam_user" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_airbyte_iam_user"
aws_iam_user_name = "${var.environment}_hm_airbyte_user"
s3_bucket_name = module.hm_amazon_s3_bucket_hm_airbyte.name
Expand All @@ -270,26 +276,31 @@ locals {
airbyte_postgres_name = "${var.environment}-hm-airbyte-postgres"
}
data "aws_secretsmanager_secret" "hm_airbyte_postgres_secret" {
name = "${var.environment}-hm-airbyte-postgres/admin"
provider = aws.production
name = "${var.environment}-hm-airbyte-postgres/admin"
}
data "aws_secretsmanager_secret_version" "hm_airbyte_postgres_secret_version" {
provider = aws.production
secret_id = data.aws_secretsmanager_secret.hm_airbyte_postgres_secret.id
}
module "hm_airbyte_postgres_security_group" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_rds_security_group"
amazon_ec2_security_group_name = "${local.airbyte_postgres_name}-security-group"
amazon_vpc_id = data.terraform_remote_state.hm_terraform_remote_state_production_aws_network.outputs.hm_amazon_vpc_id
environment = var.environment
team = var.team
}
module "hm_airbyte_postgres_subnet_group" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_rds_subnet_group"
subnet_group_name = "${local.airbyte_postgres_name}-subnet-group"
subnet_ids = var.amazon_vpc_private_subnet_ids
environment = var.environment
team = var.team
}
module "hm_airbyte_postgres_parameter_group" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_rds_parameter_group"
family = "postgres16"
parameter_group_name = "${local.airbyte_postgres_name}-parameter-group"
Expand All @@ -304,6 +315,7 @@ module "hm_airbyte_postgres_parameter_group" {
team = var.team
}
module "hm_airbyte_postgres_instance" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_rds_instance"
amazon_rds_name = local.airbyte_postgres_name
amazon_rds_engine = "postgres"
Expand Down Expand Up @@ -334,13 +346,15 @@ module "hm_kubernetes_namespace_hm_airbyte" {
# MLflow
# MLflow - S3 bucket
module "hm_amazon_s3_bucket_hm_mlflow" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_s3_bucket"
s3_bucket_name = "${var.environment}-hm-mlflow"
environment = var.environment
team = var.team
}
# MLflow - IAM role
module "hm_mlflow_iam_role" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_mlflow_iam_role"
mlflow_service_account_name = "hm-mlflow"
mlflow_namespace = "${var.environment}-hm-mlflow"
Expand All @@ -355,33 +369,39 @@ locals {
mlflow_postgres_name = "${var.environment}-hm-mlflow-postgres"
}
data "aws_secretsmanager_secret" "hm_mlflow_postgres_secret" {
name = "${var.environment}-hm-mlflow-postgres/admin"
provider = aws.production
name = "${var.environment}-hm-mlflow-postgres/admin"
}
data "aws_secretsmanager_secret_version" "hm_mlflow_postgres_secret_version" {
provider = aws.production
secret_id = data.aws_secretsmanager_secret.hm_mlflow_postgres_secret.id
}
module "hm_mlflow_postgres_security_group" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_rds_security_group"
amazon_ec2_security_group_name = "${local.mlflow_postgres_name}-security-group"
amazon_vpc_id = data.terraform_remote_state.hm_terraform_remote_state_production_aws_network.outputs.hm_amazon_vpc_id
environment = var.environment
team = var.team
}
module "hm_mlflow_postgres_subnet_group" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_rds_subnet_group"
subnet_group_name = "${local.mlflow_postgres_name}-subnet-group"
subnet_ids = var.amazon_vpc_private_subnet_ids
environment = var.environment
team = var.team
}
module "hm_mlflow_postgres_parameter_group" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_rds_parameter_group"
family = "postgres16"
parameter_group_name = "${local.mlflow_postgres_name}-parameter-group"
environment = var.environment
team = var.team
}
module "hm_mlflow_postgres_instance" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_amazon_rds_instance"
amazon_rds_name = local.mlflow_postgres_name
amazon_rds_engine = "postgres"
Expand Down Expand Up @@ -514,6 +534,7 @@ module "hm_kubernetes_namespace_hm_opencost" {
# Redpanda Console
# Redpanda Console - IAM role
module "hm_redpanda_console_iam_role" {
providers = { aws = aws.production }
source = "../../../../modules/aws/hm_redpanda_console_iam_role"
redpanda_console_service_account_name = "hm-redpanda-console"
redpanda_console_namespace = "${var.environment}-hm-redpanda-console"
Expand Down

0 comments on commit 52f4ba5

Please sign in to comment.