Skip to content

Commit

Permalink
Merge branch 'main' into verify-access
Browse files Browse the repository at this point in the history
  • Loading branch information
kunduso committed Nov 5, 2023
2 parents ac9ebc1 + a7c83f5 commit 5fa7cab
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ jobs:
if: github.ref != 'refs/heads/main' || github.event_name == 'pull_request'
run: |
terraform plan -no-color -input=false \
-var="elasticache_auth=${{ secrets.elasticache_auth }}" \
-out=TFplan.JSON
continue-on-error: true

Expand Down Expand Up @@ -161,5 +160,4 @@ jobs:
- name: Terraform Apply
if: github.ref == 'refs/heads/main'
run: |
terraform apply -auto-approve -input=false \
-var="elasticache_auth=${{ secrets.elasticache_auth }}"
terraform apply -auto-approve -input=false
2 changes: 1 addition & 1 deletion elasticache.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ resource "aws_secretsmanager_secret" "elasticache_auth" {
}
resource "aws_secretsmanager_secret_version" "auth" {
secret_id = aws_secretsmanager_secret.elasticache_auth.id
secret_string = var.elasticache_auth
secret_string = random_password.auth.result
}
#https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticache_replication_group
resource "aws_elasticache_replication_group" "app4" {
Expand Down
7 changes: 7 additions & 0 deletions provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ terraform {
source = "hashicorp/aws"
version = "5.20.1"
}
random = {
source = "hashicorp/random"
version = "3.5.1"
}
}
}

Expand All @@ -16,4 +20,7 @@ provider "aws" {
Source = "https://github.com/kunduso/add-asg-elb-terraform"
}
}
}
provider "random" {
# Configuration options
}
6 changes: 6 additions & 0 deletions random.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/auth.html#auth-overview
resource "random_password" "auth" {
length = 90
special = true
override_special = "!&#$^<>-"
}
5 changes: 0 additions & 5 deletions variable.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ variable "subnet_cidr_public" {
default = ["10.20.32.96/27"]
type = list(any)
}
variable "elasticache_auth" {
description = "The auth token to the Amazon ElastiCache cluster. This value is passed to Terraform from the pipeline."
type = string
sensitive = true
}
variable "ami_name" {
description = "The ami name of the image from where the instances will be created"
default = ["amzn2-ami-amd-hvm-2.0.20230727.0-x86_64-gp2"]
Expand Down

0 comments on commit 5fa7cab

Please sign in to comment.