+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
100 days of Cloud on GitHub – Read On iCTPro.co.nz – Read on Dev.to
Securely accesses secrets , HashiCorp explains as Vault comes with various pluggable components called secrets engines and authentication methods allowing you to integrate with external systems. Vault issues temporary tokens to access the resources.
Install AWS CLI and Configure with IAM credentialsGIF
Goto this link to install Vault
I Am using a WSL Linux on windows
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install vault
vault server -dev -dev-root-token-id="environment"
Note down the Vault Address, Unsealkey & Root token.
Enter token as “environment”
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.58.0"
}
}
}
data "vault_generic_secret" "aws_creds" {
path = "secret/aws"
}
provider "aws" {
region = data.vault_generic_secret.aws_creds.data["region"]
access_key = data.vault_generic_secret.aws_creds.data["aws_access_key_id"]
secret_key = data.vault_generic_secret.aws_creds.data["aws_secret_access_key"]
}
resource "aws_instance" "my_server" {
ami = "ami-059af0b76ba105e7e"
instance_type = "t2.nano"
tags = {
Name = "Vault-Server"
}
}
You have to change ami incase your region is not on ap-southeast-2
terraform init
terraform plan
You will be prompted to enter the vault url, in this case it is http://127.0.0.1:8200/
terraform apply -auto-approve
if you are happy with the deployment , you can tear down the deployed resources
terraform apply -auto-approve -destroy
😀🎉Congratulations🎉 you have successfully deployed IAC with Terraform VaultGIF
✅Connect with me on Twitter
🤝🏽Connect with me on Linkedin
🧑🏼🤝🧑🏻 Read more post on dev.to or iCTPro.co.nz
💻 Connect with me on GitHub
ICT professional who is highly enthusiastic about Cloud technologies and Information Security.