This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "2012-10-17", | |
| "Statement": [ | |
| { | |
| "Effect": "Allow", | |
| "Principal": { | |
| "Service": "ec2.amazonaws.com", | |
| "Service": "ssm.amazonaws.com" | |
| }, | |
| "Action": "sts:AssumeRole" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ aws ssm send-command --document-name "AWS-RunShellScript" --parameters commands=["ls -l"] --targets "Key=instanceids,Values=i-0219d24ebd3fc7b14" | |
| { | |
| "Command": { | |
| "MaxErrors": "0", | |
| "Parameters": { | |
| "commands": [ | |
| "ls -l" | |
| ] | |
| }, | |
| "DocumentName": "AWS-RunShellScript", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SSM Agent Installation | |
| sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm | |
| Loaded plugins: fastestmirror | |
| amazon-ssm-agent.rpm | 19 MB 00:00:03 | |
| Examining /var/tmp/yum-root-VVJ_i7/amazon-ssm-agent.rpm: amazon-ssm-agent-2.3.479.0-1.x86_64 | |
| Marking /var/tmp/yum-root-VVJ_i7/amazon-ssm-agent.rpm to be installed | |
| Resolving Dependencies | |
| --> Running transaction check | |
| ---> Package amazon-ssm-agent.x86_64 0:2.3.479.0-1 will be installed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pipeline { | |
| agent any | |
| tools { | |
| "org.jenkinsci.plugins.terraform.TerraformInstallation" "terraform-0.11.8" | |
| } | |
| parameters { | |
| string(name: 'WORKSPACE', defaultValue: 'development', description:'setting up workspace for terraform') | |
| } | |
| environment { | |
| TF_HOME = tool('terraform-0.11.8') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Private Route Table | |
| resource "aws_default_route_table" "private_route" { | |
| default_route_table_id = "${aws_vpc.main.default_route_table_id}" | |
| route { | |
| nat_gateway_id = "${aws_nat_gateway.test_nat_gw.id}" | |
| cidr_block = "0.0.0.0/0" | |
| } | |
| tags { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #Adding Elastic IP for NAT gateway | |
| resource "aws_eip" "test_eip" { | |
| vpc = true | |
| } | |
| #Adding NAT Gateway | |
| resource "aws_nat_gateway" "test_nat_gw" { | |
| allocation_id = "${aws_eip.test_eip.id}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "aws_vpc_peering_connection" "test-vpc" { | |
| peer_vpc_id = "${var.secondary_vpc_id}" | |
| vpc_id = "${var.primary_vpc_id}" | |
| auto_accept = true | |
| tags { | |
| Name = "my-vpc-peering" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is going to overwrite our exisiting credentials file, make sure take a backup of that | |
| provider "aws" { | |
| region = "us-west-2" | |
| } | |
| resource "aws_iam_user" "mytestuser" { | |
| name = "mytestuser" | |
| } | |
| resource "aws_iam_access_key" "myaccesskey" { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ terraform graph | |
| digraph { | |
| compound = "true" | |
| newrank = "true" | |
| subgraph "root" { | |
| "[root] aws_instance.test-instance (orphan)" [label = "aws_instance.test-instance", shape = "box"] | |
| "[root] aws_instance.test-instance1" [label = "aws_instance.test-instance1", shape = "box"] | |
| "[root] provider.aws" [label = "provider.aws", shape = "diamond"] | |
| "[root] aws_instance.test-instance (orphan)" -> "[root] provider.aws" | |
| "[root] aws_instance.test-instance1" -> "[root] provider.aws" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| provider "aws" { | |
| region = "us-west-2" | |
| } | |
| resource "aws_instance" "test-instance" { | |
| ami = "${var.centos_ami}" | |
| instance_type = "${var.instance_type}" | |
| key_name = "${var.key_name}" | |
| connection { |