From 4d6eb61f5819353f05406535c3595754a5fc3393 Mon Sep 17 00:00:00 2001 From: Julian Nonino Date: Tue, 5 May 2020 15:39:34 +0100 Subject: [PATCH] Removing provider block --- .circleci/config.yml | 8 ++++++-- examples/test/main.tf | 23 +++++++++++++++++++++++ main.tf | 24 ++++-------------------- terraform.tfvars | 7 ------- variables.tf | 11 ----------- 5 files changed, 33 insertions(+), 40 deletions(-) create mode 100644 examples/test/main.tf delete mode 100644 terraform.tfvars diff --git a/.circleci/config.yml b/.circleci/config.yml index 0fff804..af4c574 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,5 +5,9 @@ jobs: - image: hashicorp/terraform steps: - checkout - - run: terraform init - - run: terraform validate \ No newline at end of file + - run: + working_directory: examples/test + command: terraform init + - run: + working_directory: examples/test + command: terraform validate diff --git a/examples/test/main.tf b/examples/test/main.tf new file mode 100644 index 0000000..79a1045 --- /dev/null +++ b/examples/test/main.tf @@ -0,0 +1,23 @@ +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 "test" { + source = "../../" + name_preffix = "test" + vpc_id = module.base-network.vpc_id + container_image = "ubuntu" + container_name = "test" + public_subnets_ids = module.base-network.public_subnets_ids + private_subnets_ids = module.base-network.private_subnets_ids +} diff --git a/main.tf b/main.tf index d0b8ca6..ce68ee6 100644 --- a/main.tf +++ b/main.tf @@ -1,22 +1,12 @@ -# --------------------------------------------------------------------------------------------------------------------- -# PROVIDER -# --------------------------------------------------------------------------------------------------------------------- -provider "aws" { - profile = var.profile - region = var.region -} - # --------------------------------------------------------------------------------------------------------------------- # ECS Cluster # --------------------------------------------------------------------------------------------------------------------- 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}" - profile = var.profile - region = var.region } # --------------------------------------------------------------------------------------------------------------------- @@ -24,12 +14,10 @@ module ecs-cluster { # --------------------------------------------------------------------------------------------------------------------- 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 - profile = var.profile - region = var.region container_image = var.container_image container_name = var.container_name command = var.command @@ -69,12 +57,10 @@ module "td" { # --------------------------------------------------------------------------------------------------------------------- module "ecs-alb" { source = "cn-terraform/ecs-alb/aws" - version = "0.0.8" + version = "1.0.0" # source = "../terraform-aws-ecs-alb" name_preffix = "${var.name_preffix}" - profile = var.profile - region = var.region vpc_id = var.vpc_id # Application Load Balancer @@ -118,12 +104,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 - profile = var.profile - region = var.region vpc_id = var.vpc_id ecs_cluster_arn = module.ecs-cluster.aws_ecs_cluster_cluster_arn diff --git a/terraform.tfvars b/terraform.tfvars deleted file mode 100644 index edf56e2..0000000 --- a/terraform.tfvars +++ /dev/null @@ -1,7 +0,0 @@ -name_preffix="base" -profile="jnonino" -region="us-east-1" -availability_zones=[ "us-east-1a", "us-east-1b", "us-east-1c", "us-east-1d" ] -vpc_cidr_block="192.168.0.0/16" -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" ] \ No newline at end of file diff --git a/variables.tf b/variables.tf index 346e6e2..7637d82 100644 --- a/variables.tf +++ b/variables.tf @@ -5,17 +5,6 @@ variable "name_preffix" { description = "Name preffix for resources on AWS" } -# --------------------------------------------------------------------------------------------------------------------- -# AWS CREDENTIALS AND REGION -# --------------------------------------------------------------------------------------------------------------------- -variable "profile" { - description = "AWS API key credentials to use" -} - -variable "region" { - description = "AWS Region the infrastructure is hosted in" -} - # --------------------------------------------------------------------------------------------------------------------- # AWS Networking # ---------------------------------------------------------------------------------------------------------------------