Skip to content
Merged
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
17 changes: 4 additions & 13 deletions operations/_scripts/generate/generate_bitops_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ if ([[ $(alpha_only "$AWS_EC2_INSTANCE_CREATE") == true ]] ||
[[ $(alpha_only "$AWS_ECS_ENABLE") == true ]] ||
[[ $(alpha_only "$AWS_DB_PROXY_ENABLE") == true ]] ||
[[ $(alpha_only "$AWS_EKS_CREATE") == true ]] ||
[[ $(alpha_only "$AWS_REDIS_ENABLE") == true ]]) &&
[[ $(alpha_only "$AWS_REDIS_ENABLE") == true ]] ||
[[ $(alpha_only "$AWS_ECR_REPO_CREATE") == true ]]) &&
[[ "$(alpha_only $TF_STACK_DESTROY)" != "true" ]]; then
# random_integer.az_select needs to be created before the "full stack" to avoid a potential state dependency locks
targets="$targets
Expand Down Expand Up @@ -146,22 +147,12 @@ bitops:
create_bitops_terraform_config aws false targets
fi
else
if [[ $(alpha_only "$AWS_EC2_INSTANCE_CREATE") != "" ]] || [[ $(alpha_only "$AWS_EFS_ENABLE") != "" ]] || [[ "$AWS_AURORA_ENABLE" != "" ]] || [[ "$AWS_RDS_DB_ENABLE" != "" ]] || [[ "$AWS_ECS_ENABLE" != "" ]] || [[ "$AWS_RDS_PROXY_ENABLE" != "" ]] || [[ "$AWS_REDIS_ENABLE" != "" ]] || [[ "$AWS_EKS_CREATE" != "" ]]; then
if [[ $(alpha_only "$AWS_EC2_INSTANCE_CREATE") != "" ]] || [[ $(alpha_only "$AWS_EFS_ENABLE") != "" ]] || [[ "$AWS_AURORA_ENABLE" != "" ]] || [[ "$AWS_RDS_DB_ENABLE" != "" ]] || [[ "$AWS_ECS_ENABLE" != "" ]] || [[ "$AWS_RDS_PROXY_ENABLE" != "" ]] || [[ "$AWS_REDIS_ENABLE" != "" ]] || [[ "$AWS_EKS_CREATE" != "" ]] || [[ "$AWS_ECR_REPO_CREATE" != "" ]]; then
add_terraform_module aws
create_bitops_terraform_config aws true targets
fi
fi
if [[ $(alpha_only "$AWS_ECR_REPO_CREATE") != true ]]; then
if check_statefile aws ecr; then
add_terraform_module ecr
create_bitops_terraform_config ecr false
fi
else
if [[ $(alpha_only "$AWS_ECR_REPO_CREATE") == true ]]; then
add_terraform_module ecr
create_bitops_terraform_config ecr true
fi
fi

# Ansible Code part

if [[ "$(alpha_only $ANSIBLE_SKIP)" != "true" ]] && [[ "$(alpha_only $AWS_EC2_INSTANCE_CREATE)" == "true" ]]; then
Expand Down
4 changes: 1 addition & 3 deletions operations/_scripts/generate/generate_provider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ provider \"kubernetes\" {
}" >> "${GITHUB_ACTION_PATH}/operations/deployment/terraform/$1/bitovi_provider.tf"
}

generate_provider_aws aws ec2,r53,elb,efs,vpc,rds,aurora,ecs,db_proxy,redis,eks # Added eks here
#generate_provider_aws ecr ecr
#generate_provider_aws eks
generate_provider_aws aws ec2,r53,elb,efs,vpc,rds,aurora,ecs,db_proxy,redis,eks,ecr

echo "Done with generate_provider.sh"
40 changes: 0 additions & 40 deletions operations/_scripts/generate/generate_vars_terraform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -717,44 +717,4 @@ $app_install_root

" > "${GITHUB_ACTION_PATH}/operations/deployment/terraform/aws/terraform.tfvars"

# -------------------------------------------------- #
echo "
#-- AWS --#
$aws_resource_identifier
$aws_resource_identifier_supershort
$aws_additional_tags

#-- ECR --#
$aws_ecr_repo_create
$aws_ecr_repo_type
$aws_ecr_repo_name
$aws_ecr_repo_mutable
$aws_ecr_repo_encryption_type
$aws_ecr_repo_encryption_key_arn
$aws_ecr_repo_force_destroy
$aws_ecr_repo_image_scan
$aws_ecr_registry_scan_rule
$aws_ecr_registry_pull_through_cache_rules
$aws_ecr_registry_scan_config
$aws_ecr_registry_replication_rules_input
$aws_ecr_repo_policy_attach
$aws_ecr_repo_policy_create
$aws_ecr_repo_policy_input
$aws_ecr_repo_read_arn
$aws_ecr_repo_write_arn
$aws_ecr_repo_read_arn_lambda
$aws_ecr_lifecycle_policy_input
$aws_ecr_public_repo_catalog
$aws_ecr_registry_policy_input
$aws_ecr_additional_tags

#-- Application --#
$ops_repo_environment
$app_org_name
$app_repo_name
$app_branch_name

" > "${GITHUB_ACTION_PATH}/operations/deployment/terraform/ecr/terraform.tfvars"
# We might want to pass only the variables needed and not all of them.

echo "Done with generate_vars_terraform.sh"
73 changes: 42 additions & 31 deletions operations/deployment/terraform/aws/bitovi_main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ module "db_proxy" {

module "proxy_dot_env" {
source = "../modules/commons/dot_env"
count = var.aws_aurora_proxy ? 1 : var.aws_db_proxy_enable ? 1 : var.aws_rds_db_proxy ? 1 : 0
filename = "proxy.env"
content = join("\n",[try(module.db_proxy_aurora[0].proxy_dot_env,""),try(module.db_proxy_rds[0].proxy_dot_env,""),try(module.db_proxy[0].proxy_dot_env,"")])
depends_on = [ module.db_proxy_aurora,module.db_proxy_rds,module.db_proxy_rds ]
Expand Down Expand Up @@ -529,37 +530,37 @@ module "aws_route53_ecs" {
}
}

#module "aws_ecr" {
# source = "../modules/aws/ecr"
# count = var.aws_ecr_repo_create ? 1 : 0
# # ECR
# aws_ecr_repo_type = var.aws_ecr_repo_type
# aws_ecr_repo_name = var.aws_ecr_repo_name
# aws_ecr_repo_mutable = var.aws_ecr_repo_mutable
# aws_ecr_repo_encryption_type = var.aws_ecr_repo_encryption_type
# aws_ecr_repo_encryption_key_arn = var.aws_ecr_repo_encryption_key_arn
# aws_ecr_repo_force_destroy = var.aws_ecr_repo_force_destroy
# aws_ecr_repo_image_scan = var.aws_ecr_repo_image_scan
# aws_ecr_registry_scan_rule = var.aws_ecr_registry_scan_rule
# aws_ecr_registry_pull_through_cache_rules = var.aws_ecr_registry_pull_through_cache_rules
# aws_ecr_registry_scan_config = var.aws_ecr_registry_scan_config
# aws_ecr_registry_replication_rules_input = var.aws_ecr_registry_replication_rules_input
# aws_ecr_repo_policy_attach = var.aws_ecr_repo_policy_attach
# aws_ecr_repo_policy_create = var.aws_ecr_repo_policy_create
# aws_ecr_repo_policy_input = var.aws_ecr_repo_policy_input
# aws_ecr_repo_read_arn = var.aws_ecr_repo_read_arn
# aws_ecr_repo_write_arn = var.aws_ecr_repo_write_arn
# aws_ecr_repo_read_arn_lambda = var.aws_ecr_repo_read_arn_lambda
# aws_ecr_lifecycle_policy_input = var.aws_ecr_lifecycle_policy_input
# aws_ecr_public_repo_catalog = var.aws_ecr_public_repo_catalog
# aws_ecr_registry_policy_input = var.aws_ecr_registry_policy_input
# # Others
# aws_resource_identifier = var.aws_resource_identifier
#
# providers = {
# aws = aws.ecr
# }
#}
module "aws_ecr" {
source = "../modules/aws/ecr"
count = var.aws_ecr_repo_create ? 1 : 0
# ECR
aws_ecr_repo_type = var.aws_ecr_repo_type
aws_ecr_repo_name = var.aws_ecr_repo_name
aws_ecr_repo_mutable = var.aws_ecr_repo_mutable
aws_ecr_repo_encryption_type = var.aws_ecr_repo_encryption_type
aws_ecr_repo_encryption_key_arn = var.aws_ecr_repo_encryption_key_arn
aws_ecr_repo_force_destroy = var.aws_ecr_repo_force_destroy
aws_ecr_repo_image_scan = var.aws_ecr_repo_image_scan
aws_ecr_registry_scan_rule = var.aws_ecr_registry_scan_rule
aws_ecr_registry_pull_through_cache_rules = var.aws_ecr_registry_pull_through_cache_rules
aws_ecr_registry_scan_config = var.aws_ecr_registry_scan_config
aws_ecr_registry_replication_rules_input = var.aws_ecr_registry_replication_rules_input
aws_ecr_repo_policy_attach = var.aws_ecr_repo_policy_attach
aws_ecr_repo_policy_create = var.aws_ecr_repo_policy_create
aws_ecr_repo_policy_input = var.aws_ecr_repo_policy_input
aws_ecr_repo_read_arn = var.aws_ecr_repo_read_arn
aws_ecr_repo_write_arn = var.aws_ecr_repo_write_arn
aws_ecr_repo_read_arn_lambda = var.aws_ecr_repo_read_arn_lambda
aws_ecr_lifecycle_policy_input = var.aws_ecr_lifecycle_policy_input
aws_ecr_public_repo_catalog = var.aws_ecr_public_repo_catalog
aws_ecr_registry_policy_input = var.aws_ecr_registry_policy_input
# Others
aws_resource_identifier = var.aws_resource_identifier

providers = {
aws = aws.ecr
}
}

module "eks" {
source = "../modules/aws/eks"
Expand Down Expand Up @@ -824,6 +825,16 @@ output "redis_sg_id" {
value = try(module.redis[0].redis_sg_id,null)
}

# ECR

output "ecr_repository_arn" {
value = try(module.aws_ecr[0].repository_arn,null)
}

output "ecr_repository_url" {
value = try(module.aws_ecr[0].repository_url,null)
}

# EKS
output "eks_cluster_name" {
value = try(module.eks[0].aws_eks_cluster_name,null)
Expand Down
173 changes: 0 additions & 173 deletions operations/deployment/terraform/ecr/aws_variables.tf

This file was deleted.

Loading
Loading