Do a terraform inti in the directory where you have the terraform playbooks, to download the relevant plugins
terraform init
Once we do this, then we move forward with the creation of the playbooks
We include the
aws_access_key aws_secret_key in the vars
We include the public key
The vars file is called terraform.tfvars or vars.tfvars
Additonal Notes
https://github.com/hashicorp/multiple-envs/tree/master/modules/network
more terraform.tfvars
AWS_ACCESS_KEY = "xxxxxxQ"
AWS_SECRET_KEY = "xxxxxxx"
more aws.tf
# variables
variable "AWS_ACCESS_KEY" {}
variable "AWS_SECRET_KEY" {}
provider "aws" {
access_key = "${var.AWS_ACCESS_KEY}"
secret_key = "${var.AWS_SECRET_KEY}"
region = "us-east-1"
}
resource "aws_key_pair" "jenkins_key" {
key_name = "jenkins_key"
public_key = "ssh-rsa xxxxxxxxx vitikyalapati@splunk.com"
}
resource "aws_instance" "atest" {
ami = "ami-2757f631"
instance_type = "t2.micro"
key_name = "${aws_key_pair.jenkins_key.key_name}"
tags {
Name = "Test Changes"
}
}
No comments:
Post a Comment