-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from sjmiller609/master
Adding drone pipeline
- Loading branch information
Showing
13 changed files
with
210 additions
and
63 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
kind: pipeline | ||
name: terraform-aws-astronomer-aws | ||
|
||
steps: | ||
|
||
- name: lint | ||
image: hashicorp/terraform:light | ||
commands: | ||
- cp providers.tf.example providers.tf | ||
- terraform init | ||
- terraform fmt -check=true | ||
- terraform validate -var "deployment_id=validate" -var "route53_domain=validate-fake.com" -var "admin_email=fake@mailinator.com" | ||
- | | ||
for example in $(find examples -maxdepth 1 -mindepth 1 -type d); do | ||
cp providers.tf $example | ||
cd $example | ||
echo $example | ||
terraform init | ||
terraform fmt -check=true | ||
terraform validate -var "deployment_id=citest" | ||
cd - | ||
done | ||
- terraform -v | ||
when: | ||
event: | ||
- pull_request | ||
- push | ||
|
||
- name: from_scratch | ||
image: hashicorp/terraform:light | ||
depends_on: | ||
- lint | ||
environment: | ||
AWS_ACCESS_KEY_ID: | ||
from_secret: AWS_ACCESS_KEY_ID | ||
AWS_SECRET_ACCESS_KEY: | ||
from_secret: AWS_SECRET_ACCESS_KEY | ||
commands: | ||
- cp providers.tf.example examples/from_scratch/providers.tf | ||
- cp backend.tf.example examples/from_scratch/backend.tf | ||
- cd examples/from_scratch | ||
- sed -i "s/REPLACE/$DRONE_BUILD_NUMBER/g" backend.tf | ||
- terraform init | ||
- terraform apply --auto-approve -var "deployment_id=fromscratch$DRONE_BUILD_NUMBER" | ||
- terraform -v | ||
when: | ||
event: | ||
- push | ||
branch: | ||
- master | ||
|
||
- name: from_scratch_cleanup | ||
depends_on: | ||
- from_scratch | ||
image: hashicorp/terraform:light | ||
environment: | ||
AWS_ACCESS_KEY_ID: | ||
from_secret: AWS_ACCESS_KEY_ID | ||
AWS_SECRET_ACCESS_KEY: | ||
from_secret: AWS_SECRET_ACCESS_KEY | ||
commands: | ||
- cp providers.tf.example examples/from_scratch/providers.tf | ||
- cp backend.tf.example examples/from_scratch/backend.tf | ||
- cd examples/from_scratch | ||
- sed -i "s/REPLACE/$DRONE_BUILD_NUMBER/g" backend.tf | ||
- terraform init | ||
- terraform destroy --auto-approve -var "deployment_id=fromscratch$DRONE_BUILD_NUMBER" -refresh=false | ||
- terraform -v | ||
when: | ||
event: | ||
- push | ||
status: | ||
- failure | ||
- success | ||
branch: | ||
- master | ||
|
||
- name: into_subnets | ||
image: hashicorp/terraform:light | ||
depends_on: | ||
- lint | ||
environment: | ||
AWS_ACCESS_KEY_ID: | ||
from_secret: AWS_ACCESS_KEY_ID | ||
AWS_SECRET_ACCESS_KEY: | ||
from_secret: AWS_SECRET_ACCESS_KEY | ||
commands: | ||
- cp providers.tf.example examples/into_existing_subnets/providers.tf | ||
- cp backend.tf.example examples/into_existing_subnets/backend.tf | ||
- cd examples/into_existing_subnets | ||
- sed -i "s/REPLACE/$DRONE_BUILD_NUMBERintosubnets/g" backend.tf | ||
- terraform init | ||
- terraform apply --auto-approve -var "deployment_id=intosubnets$DRONE_BUILD_NUMBER" | ||
- terraform -v | ||
when: | ||
event: | ||
- push | ||
branch: | ||
- master | ||
|
||
- name: into_subnets_cleanup | ||
depends_on: | ||
- into_subnets | ||
image: hashicorp/terraform:light | ||
environment: | ||
AWS_ACCESS_KEY_ID: | ||
from_secret: AWS_ACCESS_KEY_ID | ||
AWS_SECRET_ACCESS_KEY: | ||
from_secret: AWS_SECRET_ACCESS_KEY | ||
commands: | ||
- cp providers.tf.example examples/into_existing_subnets/providers.tf | ||
- cp backend.tf.example examples/into_existing_subnets/backend.tf | ||
- cd examples/into_existing_subnets | ||
- sed -i "s/REPLACE/$DRONE_BUILD_NUMBERintosubnets/g" backend.tf | ||
- terraform init | ||
- terraform destroy --auto-approve -var "deployment_id=intosubnets$DRONE_BUILD_NUMBER" -refresh=false | ||
- terraform -v | ||
when: | ||
event: | ||
- push | ||
status: | ||
- failure | ||
- success | ||
branch: | ||
- master |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ config-map* | |
*.log | ||
*.tfvars* | ||
*.zip | ||
examples/*/.terraform |
This file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_version = ">= 0.12" | ||
backend "s3" { | ||
bucket = "ci-terraform-state-astronomer" | ||
key = "REPLACE/terraform.tfstate" | ||
region = "us-east-1" | ||
encrypt = true | ||
} | ||
} |
This file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
variable deployment_id {} | ||
|
||
# this is how the module can be called | ||
# if you want to create a VPC and the subnets | ||
# from scratch. | ||
module "astronomer_aws_with_vpc" { | ||
source = "../.." | ||
# you should use the following commented lines, not | ||
# the above "../.." if you want to consume this remotely | ||
# source = "astronomer/astronomer-aws/aws" | ||
# version = "<fill me in>" # Look here https://registry.terraform.io/modules/astronomer/astronomer-aws/aws | ||
deployment_id = var.deployment_id | ||
admin_email = "steven@astronomer.io" | ||
route53_domain = "astronomer-development.com" | ||
management_api = "public" | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
variable deployment_id {} | ||
|
||
# This is a sample vpc configuration | ||
# you may choose to use your own, existing | ||
# VPC. | ||
module "vpc" { | ||
|
||
source = "terraform-aws-modules/vpc/aws" | ||
version = "2.5.0" | ||
|
||
name = "simple-example" | ||
|
||
cidr = "10.0.0.0/16" | ||
|
||
azs = ["us-east-1a", "us-east-1b", "us-east-1c"] | ||
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"] | ||
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"] | ||
|
||
assign_generated_ipv6_cidr_block = true | ||
|
||
enable_nat_gateway = true | ||
single_nat_gateway = true | ||
|
||
} | ||
|
||
# this is how the module can be called if you | ||
# want to deploy into a set of existing, private subnets | ||
module "astronomer_aws_in_specific_subnet" { | ||
# same idea above - use a different 'source', and specify 'version' | ||
source = "../.." | ||
deployment_id = var.deployment_id | ||
admin_email = "steven@astronomer.io" | ||
route53_domain = "astronomer-development.com" | ||
management_api = "public" | ||
|
||
vpc_id = module.vpc.vpc_id | ||
private_subnets = module.vpc.private_subnets | ||
} |
This file contains 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 file contains 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 file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
provider "acme" { | ||
server_url = "https://acme-staging-v02.api.letsencrypt.org/directory" | ||
} | ||
|
||
provider "aws" { | ||
region = "us-east-1" | ||
region = "us-east-1" | ||
} | ||
|
||
provider "acme" { | ||
server_url = "https://acme-staging-v02.api.letsencrypt.org/directory" | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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