Skip to content

Commit

Permalink
Merge pull request #49 from Digital-Defiance/48-reset-ec2-machine
Browse files Browse the repository at this point in the history
refactor(tf): force destroy/create of ec2 machine
  • Loading branch information
RuiFilipeCampos authored Aug 26, 2024
2 parents 942b511 + 3023904 commit 475381d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
7 changes: 3 additions & 4 deletions .1password
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
AWS_ACCESS_KEY_ID="op://digital-defiance-secrets/aws_credentials/AWS_ACCESS_KEY_ID"
AWS_SECRET_ACCESS_KEY="op://digital-defiance-secrets/aws_credentials/AWS_SECRET_ACCESS_KEY"

TF_TOKEN_app_terraform_io="op://digital-defiance-secrets/terraform_credentials/TF_TOKEN_app_terraform_io"
export AWS_ACCESS_KEY_ID="op://digital-defiance-secrets/aws_credentials/AWS_ACCESS_KEY_ID"
export AWS_SECRET_ACCESS_KEY="op://digital-defiance-secrets/aws_credentials/AWS_SECRET_ACCESS_KEY"
export TF_TOKEN_app_terraform_io="op://digital-defiance-secrets/terraform_credentials/TF_TOKEN_app_terraform_io"
15 changes: 10 additions & 5 deletions k8s/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,6 @@ module "irsa-ebs-csi" {
}


output "aws_configuration_command" {
value = "aws eks update-kubeconfig --region eu-south-1 --name ${module.eks.cluster_name}"
}



Expand Down Expand Up @@ -197,7 +194,7 @@ resource "aws_ebs_encryption_by_default" "enabled" {
enabled = true
}

module "ec2_instance" {
module "ec2_temp_instance" {


ami = data.aws_ami.ubuntu.id
Expand Down Expand Up @@ -268,9 +265,17 @@ EOF

resource "aws_eip_association" "eip_assoc" {
count = 1
instance_id = module.ec2_instance.id
instance_id = module.ec2_temp_instance.id
allocation_id = resource.aws_eip.ip_of_manager_instance.id
depends_on = [
module.vpc,
]
}

output "ssh_command" {
value = "ssh -i id_ed ubuntu@${module.ec2_temp_instance.public_ip}"
}

output "aws_configuration_command" {
value = "aws eks update-kubeconfig --region eu-south-1 --name ${module.eks.cluster_name}"
}

0 comments on commit 475381d

Please sign in to comment.