From a6127b49f1289b63cfef004456b18dcab4227826 Mon Sep 17 00:00:00 2001 From: Julian Nonino Date: Tue, 5 May 2020 16:10:36 +0100 Subject: [PATCH] Removing provider block --- .circleci/config.yml | 8 ++++++-- README.md | 15 --------------- examples/test/main.tf | 15 +++++++++++++++ main.tf | 8 -------- variables.tf | 13 +------------ 5 files changed, 22 insertions(+), 37 deletions(-) create mode 100644 examples/test/main.tf 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/README.md b/README.md index ab9602c..648900d 100644 --- a/README.md +++ b/README.md @@ -15,21 +15,6 @@ Check valid versions on: * Github Releases: * Terraform Module Registry: - module "ec2-asg" { - source = "cn-terraform/ec2-asg/aws" - version = "1.0.2" - name_preffix = var.name_preffix - profile = var.profile - region = var.region - image_id = var.image_id - instance_type = var.instance_type - max_size = var.max_size - min_size = var.min_size - availability_zones = var.availability_zones - } - -In the example only required values are show, but you can configure all values for this resources. Check documentation on: - ## Output values * lc_name: The name of the launch configuration. * lc_id: The ID of the launch configuration. diff --git a/examples/test/main.tf b/examples/test/main.tf new file mode 100644 index 0000000..7f2717a --- /dev/null +++ b/examples/test/main.tf @@ -0,0 +1,15 @@ +provider "aws" { + region = "us-east-1" +} + +module "asg" { + source = "../../" + name_preffix = "test" + image_id = "ami-00579fbb15b954340" + instance_type = "t3.micro" + associate_public_ip_address = true + max_size = 3 + min_size = 1 +} + + diff --git a/main.tf b/main.tf index ea7ca58..245ef3a 100644 --- a/main.tf +++ b/main.tf @@ -1,11 +1,3 @@ -# --------------------------------------------------------------------------------------------------------------------- -# PROVIDER -# --------------------------------------------------------------------------------------------------------------------- -provider "aws" { - profile = var.profile - region = var.region -} - # --------------------------------------------------------------------------------------------------------------------- # Launch Configuration # --------------------------------------------------------------------------------------------------------------------- diff --git a/variables.tf b/variables.tf index 8a4598b..72237f0 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 EC2 LAUNCH CONFIGURATION # --------------------------------------------------------------------------------------------------------------------- @@ -194,6 +183,6 @@ variable "service_linked_role_arn" { default = "" } # NOT CONSIDERED - # launch_template - (Optional) Nested argument with Launch template specification to use to launch instances. + # launch_template - (Optional) Nested argument with Launch template specification to use to launch instances. # mixed_instances_policy (Optional) Configuration block containing settings to define launch targets for Auto Scaling groups. Defined below. # initial_lifecycle_hook - (Optional) One or more Lifecycle Hooks to attach to the autoscaling group before instances are launched. The syntax is exactly the same as the separate aws_autoscaling_lifecycle_hook resource, without the autoscaling_group_name attribute. Please note that this will only work when creating a new autoscaling group. For all other use-cases, please use aws_autoscaling_lifecycle_hook resource.