Skip to content

Commit

Permalink
Removing provider block
Browse files Browse the repository at this point in the history
  • Loading branch information
jnonino committed May 5, 2020
1 parent a7faad0 commit 8096590
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 61 deletions.
8 changes: 6 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ jobs:
- image: hashicorp/terraform
steps:
- checkout
- run: terraform init
- run: terraform validate
- run:
working_directory: examples/test
command: terraform init
- run:
working_directory: examples/test
command: terraform validate
29 changes: 3 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,9 @@ Check valid versions on:
* Github Releases: <https://github.com/cn-terraform/terraform-aws-jenkins/releases>
* Terraform Module Registry: <https://registry.terraform.io/modules/cn-terraform/jenkins/aws>

module "jenkins" {
source = "cn-terraform/jenkins/aws"
version = "2.0.2"
name_preffix = var.name_preffix
profile = var.profile
region = var.region
vpc_id = module.networking.vpc_id
public_subnets_ids = module.networking.public_subnets_ids
private_subnets_ids = module.networking.private_subnets_ids
}

The networking module should look like this:

module "networking" {
source = "cn-terraform/networking/aws"
version = "2.0.5"
name_preffix = "base"
profile = "aws_profile"
region = "us-east-1"
vpc_cidr_block = "192.168.0.0/16"
availability_zones = [ "us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d" ]
public_subnets_cidrs_per_availability_zone = [ "192.168.0.0/19", "192.168.32.0/19", "192.168.64.0/19", "192.168.96.0/19" ]
private_subnets_cidrs_per_availability_zone = [ "192.168.128.0/19", "192.168.160.0/19", "192.168.192.0/19", "192.168.224.0/19" ]
}

Check versions for this module on:
## Other modules that you may need to use this module

The Networking module:
* Github Releases: <https://github.com/cn-terraform/terraform-aws-networking/releases>
* Terraform Module Registry: <https://registry.terraform.io/modules/cn-terraform/networking/aws>

Expand Down
22 changes: 22 additions & 0 deletions examples/test/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
provider "aws" {
region = "us-east-1"
}

module "base-network" {
source = "cn-terraform/networking/aws"
version = "2.0.7"
name_preffix = "test-networking"
vpc_cidr_block = "192.168.0.0/16"
availability_zones = [ "us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d" ]
public_subnets_cidrs_per_availability_zone = [ "192.168.0.0/19", "192.168.32.0/19", "192.168.64.0/19", "192.168.96.0/19" ]
private_subnets_cidrs_per_availability_zone = [ "192.168.128.0/19", "192.168.160.0/19", "192.168.192.0/19", "192.168.224.0/19" ]
}

module "jenkins" {
source = "../../"
name_preffix = "jenkins"
region = "us-east-1"
vpc_id = module.base-network.vpc_id
public_subnets_ids = module.base-network.public_subnets_ids
private_subnets_ids = module.base-network.private_subnets_ids
}
28 changes: 5 additions & 23 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
# ---------------------------------------------------------------------------------------------------------------------
# PROVIDER
# ---------------------------------------------------------------------------------------------------------------------
provider "aws" {
profile = var.profile
region = var.region
}

# ---------------------------------------------------------------------------------------------------------------------
# AWS Cloudwatch Logs
# ---------------------------------------------------------------------------------------------------------------------
module aws_cw_logs {
source = "cn-terraform/cloudwatch-logs/aws"
version = "1.0.5"
version = "1.0.6"
# source = "../terraform-aws-cloudwatch-logs"

logs_path = "/ecs/service/${var.name_preffix}-jenkins-master"
profile = var.profile
region = var.region
}

# ---------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -52,12 +42,10 @@ locals {
# ---------------------------------------------------------------------------------------------------------------------
module ecs-cluster {
source = "cn-terraform/ecs-cluster/aws"
version = "1.0.3"
version = "1.0.5"
# source = "../terraform-aws-ecs-cluster"

name = "${var.name_preffix}-jenkins"
profile = var.profile
region = var.region
}

# ---------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -110,12 +98,10 @@ resource "aws_efs_mount_target" "jenkins_data_mount_targets" {
# ---------------------------------------------------------------------------------------------------------------------
module "td" {
source = "cn-terraform/ecs-fargate-task-definition/aws"
version = "1.0.10"
version = "1.0.11"
# source = "../terraform-aws-ecs-fargate-task-definition"

name_preffix = "${var.name_preffix}-jenkins"
profile = var.profile
region = var.region
container_name = local.container_name
container_image = "cnservices/jenkins-master"
container_cpu = 2048 # 2 vCPU - https://docs.aws.amazon.com/AmazonECS/latest/developerguide/AWS_Fargate.html#fargate-task-defs
Expand Down Expand Up @@ -153,12 +139,10 @@ module "td" {
# ---------------------------------------------------------------------------------------------------------------------
module "ecs-alb" {
source = "cn-terraform/ecs-alb/aws"
version = "0.0.9"
version = "1.0.0"
# source = "../terraform-aws-ecs-alb"

name_preffix = "${var.name_preffix}-jenkins"
profile = var.profile
region = var.region
vpc_id = var.vpc_id
private_subnets = var.private_subnets_ids
public_subnets = var.public_subnets_ids
Expand All @@ -171,12 +155,10 @@ module "ecs-alb" {
# ---------------------------------------------------------------------------------------------------------------------
module ecs-fargate-service {
source = "cn-terraform/ecs-fargate-service/aws"
version = "2.0.1"
version = "2.0.2"
# source = "../terraform-aws-ecs-fargate-service"

name_preffix = "${var.name_preffix}-jenkins"
profile = var.profile
region = var.region
vpc_id = var.vpc_id
ecs_cluster_arn = module.ecs-cluster.aws_ecs_cluster_cluster_arn
health_check_grace_period_seconds = 120
Expand Down
6 changes: 0 additions & 6 deletions terraform.tfvars

This file was deleted.

4 changes: 0 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ variable "name_preffix" {
# ---------------------------------------------------------------------------------------------------------------------
# AWS CREDENTIALS AND REGION
# ---------------------------------------------------------------------------------------------------------------------
variable "profile" {
description = "AWS API key credentials to use"
}

variable "region" {
description = "AWS Region the infrastructure is hosted in"
}
Expand Down

0 comments on commit 8096590

Please sign in to comment.