Skip to content

Commit

Permalink
Revert "Feature | build.env to tf 1.0.9 + configs updated to .tfvars …
Browse files Browse the repository at this point in the history
…=> leverage cli 1.1.0 + deactivate cf-s3-www.binbash.com.ar"
  • Loading branch information
exequielrafaela authored Oct 28, 2021
1 parent 6bd6c1b commit 0725927
Show file tree
Hide file tree
Showing 97 changed files with 246 additions and 107 deletions.
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
############
id_rsa
id_dsa
*keys/
keys/
!/apps-devstg/base-identities/keys/
!/apps-prd/base-identities/keys/
!/security/base-identities/keys/
!/shared/base-identities/keys/
!/root/base-identities/keys/

# OS generated files #
######################
Expand Down Expand Up @@ -93,7 +98,7 @@ Thumbs.db
#
# Config Files
#
*common.tfvars
*common.config
#
# Scripts and Makefiles
#
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# AWS Provider Settings #
#=============================#
provider "aws" {
version = "~> 3.0"
region = var.region
profile = var.profile
shared_credentials_file = "~/.aws/${var.project}/config"
Expand All @@ -13,9 +14,9 @@ provider "aws" {
# binbash-shared route53 cross-account ACM dns validation update
#
provider "aws" {
version = "~> 3.0"
region = var.region
profile = "${var.project}-shared-devops"
// profile = var.profile_shared
profile = var.profile_shared
shared_credentials_file = "~/.aws/${var.project}/config"
alias = "shared-route53"
}
Expand All @@ -24,11 +25,7 @@ provider "aws" {
# Backend Config (partial) #
#=============================#
terraform {
required_version = ">= 0.14.11"

required_providers {
aws = "~> 3.0"
}
required_version = ">= 0.13.2"

backend "s3" {
key = "apps-devstg/cdn-s3/terraform.tfstate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Statics S3 Bucket + CloudFront CDN for moderncare.com
#
module "dev_aws_binbash_com_ar" {
source = "github.com/binbashar/terraform-aws-cloudfront-s3-cdn.git?ref=0.75.0"
source = "github.com/binbashar/terraform-aws-cloudfront-s3-cdn.git?ref=0.35.0"

# Common: bucket naming convention is "bb-apps-devstg-frontend-[DOMAIN_NAME]-origin"
namespace = "${var.project}-${var.environment}-frontend"
Expand Down Expand Up @@ -33,7 +33,6 @@ module "dev_aws_binbash_com_ar" {
minimum_protocol_version = "TLSv1"
encryption_enabled = true
additional_bucket_policy = data.aws_iam_policy_document.additional_bucket_policy.json
versioning_enabled = true

logging_enabled = true
log_expiration_days = 90 # N° of days after which to expunge the objects
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,6 @@ variable "appsprd_account_id" {
description = "Account: Prod Modules & Libs"
}

variable "vault_address" {
type = string
description = "Vault Address"
}

variable "vault_token" {
type = string
description = "Vault Token"
}

#=============================#
# CDN DNS variables #
#=============================#
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ provider "aws" {
#
provider "aws" {
region = var.region
profile = "${var.project}-shared-devops"
// profile = var.profile_shared
profile = var.profile_shared
shared_credentials_file = "~/.aws/${var.project}/config"
alias = "shared-route53"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Statics S3 Bucket + CloudFront CDN for moderncare.com
#
module "www_binbash_com_ar_statics" {
source = "github.com/binbashar/terraform-aws-cloudfront-s3-cdn.git?ref=0.75.0"
source = "github.com/binbashar/terraform-aws-cloudfront-s3-cdn.git?ref=0.69.0"

# Common: bucket naming convention is "[PROJECT]-[ENV]-statics-[DOMAIN_NAME]"
namespace = "${var.project}-${var.environment}-statics"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,6 @@ variable "appsprd_account_id" {
description = "Account: Prod Modules & Libs"
}

variable "vault_address" {
type = string
description = "Vault Address"
}

variable "vault_token" {
type = string
description = "Vault Token"
}

#=============================#
# CDN DNS variables #
#=============================#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Statics S3 Bucket + CloudFront CDN for moderncare.com
#
module "www_binbash_com_ar" {
source = "github.com/binbashar/terraform-aws-cloudfront-s3-cdn.git?ref=0.75.0"
source = "github.com/binbashar/terraform-aws-cloudfront-s3-cdn.git?ref=0.69.0"

# Common: bucket naming convention is "bb-apps-prd-frontend-[DOMAIN_NAME]-origin"
namespace = "${var.project}-${var.environment}-frontend"
Expand Down
2 changes: 1 addition & 1 deletion build.env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ MFA_ENABLED=true

# Terraform
TERRAFORM_IMAGE_NAME=binbash/terraform-awscli-slim
TERRAFORM_IMAGE_TAG=1.0.9
TERRAFORM_IMAGE_TAG=0.14.11
TERRAFORM_ENTRYPOINT=/bin/terraform
TERRAFORM_MFA_ENTRYPOINT=/root/scripts/aws-mfa/aws-mfa-entrypoint.sh
File renamed without changes.
41 changes: 0 additions & 41 deletions config/common.tfvars

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ variable "vpc_endpoints" {
variable "enable_tgw" {
description = "Enable Transit Gateway Support"
type = bool
default = false
default = true
}

variable "enable_vpc_attach" {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions network/security-keys/build.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TERRAFORM_IMAGE_TAG=0.14.11
23 changes: 23 additions & 0 deletions network/security-keys/config.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#=============================#
# AWS Provider Settings #
#=============================#
provider "aws" {
region = var.region
profile = var.profile
shared_credentials_file = "~/.aws/${var.project}/config"
}

#=============================#
# Backend Config (partial) #
#=============================#
terraform {
required_version = ">= 0.14.11"

required_providers {
aws = "~> 3.0"
}

backend "s3" {
key = "network/security-keys/terraform.tfstate"
}
}
52 changes: 52 additions & 0 deletions network/security-keys/kms.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
module "kms_key" {
source = "github.com/binbashar/terraform-aws-kms-key.git?ref=0.10.0"

enabled = true
namespace = var.project
stage = var.environment
name = var.kms_key_name
delimiter = "-"
description = "KMS key for ${var.environment} Account"
deletion_window_in_days = 7
enable_key_rotation = true
alias = "alias/${var.project}_${var.environment}_${var.kms_key_name}_key"
policy = data.aws_iam_policy_document.kms.json
tags = local.tags
}

data "aws_iam_policy_document" "kms" {
statement {
sid = "Enable IAM User Permissions"
effect = "Allow"
actions = ["kms:*"]
resources = ["*"]

principals {
type = "AWS"
identifiers = ["arn:aws:iam::${var.network_account_id}:root"]
}
}

statement {
sid = "Enable CloudWatch Logs Service"
effect = "Allow"
actions = [
"kms:Encrypt*",
"kms:Decrypt*",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:Describe*"
]
resources = ["*"]

principals {
type = "Service"
identifiers = ["logs.${var.region}.amazonaws.com"]
}
condition {
test = "ArnLike"
variable = "kms:EncryptionContext:aws:logs:arn"
values = ["arn:aws:logs:${var.region}:${var.network_account_id}:*"]
}
}
}
6 changes: 6 additions & 0 deletions network/security-keys/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
locals {
tags = {
Terraform = "true"
Environment = var.environment
}
}
29 changes: 29 additions & 0 deletions network/security-keys/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# EC2 aws_key_pair name
#
output "aws_key_pair_name" {
value = aws_key_pair.compute-ssh-key.key_name
}

#
# KMS aws_kms_key outputs
#
output "aws_kms_key_arn" {
description = "Key ARN"
value = module.kms_key.key_arn
}

output "aws_kms_key_id" {
description = "KMS Key ID"
value = module.kms_key.key_id
}

output "aws_kms_key_alias_arn" {
description = "KMS Alias ARN"
value = module.kms_key.alias_arn
}

output "aws_kms_key_alias_name" {
description = "KMS Alias name"
value = module.kms_key.alias_name
}
4 changes: 4 additions & 0 deletions network/security-keys/ssh.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource "aws_key_pair" "compute-ssh-key" {
key_name = var.compute_ssh_key_name
public_key = var.compute_ssh_public_key
}
Loading

0 comments on commit 0725927

Please sign in to comment.