diff --git a/examples/README.md b/examples/README.md index 154a2f46a1..79abd998f6 100644 --- a/examples/README.md +++ b/examples/README.md @@ -8,9 +8,17 @@ To run any example, just run `terraform apply` within that directory if you have Terraform checked out. Or, you can run it directly from git: ``` -$ terraform init github.com/hashicorp/terraform/examples/aws-two-tier +$ terraform init github.com/hashicorp/terraform/examples/cross-provider ... $ terraform apply ... ``` + +## Provider-specific Examples + +Terraform providers each live in their own repository. Some of these +repositories contain documentation specific to their provider: + +* [AliCloud Examples](https://github.com/terraform-providers/terraform-provider-alicloud/tree/master/examples) +* [Amazon Web Services Examples](https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples) diff --git a/examples/alicloud-build-lnmp/main.tf b/examples/alicloud-build-lnmp/main.tf deleted file mode 100644 index 7cd6711f2c..0000000000 --- a/examples/alicloud-build-lnmp/main.tf +++ /dev/null @@ -1,119 +0,0 @@ - -provider "alicloud" { - region = "${var.region}" -} - -data "alicloud_instance_types" "1c2g" { - cpu_core_count = 2 - memory_size = 4 - instance_type_family = "ecs.n1" -} - -data "alicloud_images" "centos" { - most_recent = true - name_regex = "^centos_7\\w.*" -} - -data "alicloud_zones" "default" { - "available_instance_type"= "${data.alicloud_instance_types.1c2g.instance_types.0.id}" - "available_disk_category"= "${var.disk_category}" -} - -resource "alicloud_vpc" "default" { - cidr_block = "${var.vpc_cidr}" -} - -resource "alicloud_vswitch" "vsw" { - vpc_id = "${alicloud_vpc.default.id}" - cidr_block = "${var.vswitch_cidr}" - availability_zone = "${data.alicloud_zones.default.zones.0.id}" -} - -resource "alicloud_security_group" "sg" { - name = "sg" - vpc_id = "${alicloud_vpc.default.id}" -} - -resource "alicloud_security_group_rule" "in-all" { - type = "ingress" - ip_protocol = "all" - nic_type = "intranet" - policy = "accept" - port_range = "-1/-1" - priority = 1 - security_group_id = "${alicloud_security_group.sg.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_security_group_rule" "en-all" { - type = "egress" - ip_protocol = "all" - nic_type = "intranet" - policy = "accept" - port_range = "-1/-1" - priority = 1 - security_group_id = "${alicloud_security_group.sg.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_instance" "webserver" { - security_groups = ["${alicloud_security_group.sg.id}"] - vswitch_id = "${alicloud_vswitch.vsw.id}" - - # series II - instance_charge_type = "PostPaid" - instance_type = "${data.alicloud_instance_types.1c2g.instance_types.0.id}" - internet_max_bandwidth_out = 0 - io_optimized = "${var.io_optimized}" - - system_disk_category = "${var.disk_category}" - image_id = "${data.alicloud_images.centos.images.0.id}" - - instance_name = "tf_lnmp" - password= "${var.ecs_password}" - - user_data = "${data.template_file.shell.rendered}" -} - -data "template_file" "shell" { - template = "${file("userdata.sh")}" - - vars { - db_name = "${var.db_name}" - db_user = "${var.db_user}" - db_pwd = "${var.db_password}" - db_root_pwd = "${var.db_root_password}" - } -} - -resource "alicloud_nat_gateway" "default" { - vpc_id = "${alicloud_vpc.default.id}" - spec = "Small" - bandwidth_packages = [{ - ip_count = 2 - bandwidth = 10 - zone = "${data.alicloud_zones.default.zones.0.id}" - }] - depends_on = [ - "alicloud_vswitch.vsw"] -} - -resource "alicloud_forward_entry" "dnat"{ - forward_table_id = "${alicloud_nat_gateway.default.forward_table_ids}" - external_ip = "${element(split(",", alicloud_nat_gateway.default.bandwidth_packages.0.public_ip_addresses),1)}" - external_port = "any" - ip_protocol = "any" - internal_ip = "${alicloud_instance.webserver.private_ip}" - internal_port = "any" -} - -resource "alicloud_snat_entry" "snat"{ - snat_table_id = "${alicloud_nat_gateway.default.snat_table_ids}" - source_vswitch_id = "${alicloud_vswitch.vsw.id}" - snat_ip = "${element(split(",", alicloud_nat_gateway.default.bandwidth_packages.0.public_ip_addresses),0)}" -} - - - - - diff --git a/examples/alicloud-build-lnmp/outputs.tf b/examples/alicloud-build-lnmp/outputs.tf deleted file mode 100644 index e0556467f9..0000000000 --- a/examples/alicloud-build-lnmp/outputs.tf +++ /dev/null @@ -1,3 +0,0 @@ -output "nginx_url" { - value = "${element(split(",", alicloud_nat_gateway.default.bandwidth_packages.0.public_ip_addresses),1)}:80/test.php" -} \ No newline at end of file diff --git a/examples/alicloud-build-lnmp/userdata.sh b/examples/alicloud-build-lnmp/userdata.sh deleted file mode 100644 index 644e78f7ce..0000000000 --- a/examples/alicloud-build-lnmp/userdata.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -NginxUrl=http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm -dbname=${db_name} -dbuser=${db_user} -dbpassword=${db_pwd} -dbrootpassword=${db_root_pwd} -export HOME=/root -export HOSTNAME=`hostname` -systemctl stop firewalld.service -systemctl disable firewalld.service -sed -i 's/^SELINUX=/# SELINUX=/' /etc/selinux/config -sed -i '/# SELINUX=/a SELINUX=disabled' /etc/selinux/config -setenforce 0 -yum install yum-priorities -y -yum -y install aria2 -aria2c $NginxUrl -rpm -ivh nginx-*.rpm -yum -y install nginx -systemctl start nginx.service -systemctl enable nginx.service -yum -y install php-fpm -systemctl start php-fpm.service -systemctl enable php-fpm.service -sed -i '/FastCGI/,/htaccess/s/ #/ /' /etc/nginx/conf.d/default.conf -sed -i '/FastCGI/s/^ / #/' /etc/nginx/conf.d/default.conf -sed -i '/htaccess/s/^ / #/' /etc/nginx/conf.d/default.conf -sed -i '/SCRIPT_FILENAME/s/\/scripts/\/usr\/share\/nginx\/html\//' /etc/nginx/conf.d/default.conf -yum -y install mariadb mariadb-server -systemctl start mariadb.service -systemctl enable mariadb.service -yum -y install php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash php-mcrypt -MDSRING=`find / -name mbstring.so` -echo extension=$MDSRING >> /etc/php.ini -systemctl restart mariadb.service -mysqladmin -u root password "$dbrootpassword" -$(mysql $dbname -u root --password="$dbrootpassword" >/dev/null 2>&1 /tmp/setup.mysql -echo GRANT ALL ON $dbname.* TO "$dbuser"@"localhost" IDENTIFIED BY "'$dbpassword'" \; >> /tmp/setup.mysql -mysql -u root --password="$dbrootpassword" < /tmp/setup.mysql -$(mysql $dbname -u root --password="$dbrootpassword" >/dev/null 2>&1 /usr/share/nginx/html/test.php -echo \$conn=mysql_connect\("'127.0.0.1'", "'$dbuser'", "'$dbpassword'"\)\; >> /usr/share/nginx/html/test.php -echo if \(\$conn\){ >> /usr/share/nginx/html/test.php -echo echo \"LNMP platform connect to mysql is successful\!\"\; >> /usr/share/nginx/html/test.php -echo }else{ >> /usr/share/nginx/html/test.php -echo echo \"LNMP platform connect to mysql is failed\!\"\; >> /usr/share/nginx/html/test.php -echo } >> /usr/share/nginx/html/test.php -echo phpinfo\(\)\; >> /usr/share/nginx/html/test.php -echo \?\> >> /usr/share/nginx/html/test.php \ No newline at end of file diff --git a/examples/alicloud-build-lnmp/variables.tf b/examples/alicloud-build-lnmp/variables.tf deleted file mode 100644 index eb9d8fe5ae..0000000000 --- a/examples/alicloud-build-lnmp/variables.tf +++ /dev/null @@ -1,30 +0,0 @@ -variable "region" { - default = "cn-beijing" -} -variable "vpc_cidr" { - default = "10.1.0.0/21" -} -variable "vswitch_cidr" { - default = "10.1.1.0/24" -} -variable "io_optimized" { - default = "optimized" -} -variable "ecs_password" { - default = "Test1234567*" -} -variable "disk_category" { - default = "cloud_efficiency" -} -variable "db_name" { - default = "lnmp" -} -variable "db_user" { - default = "alier" -} -variable "db_password" { - default = "123456" -} -variable "db_root_password" { - default = "123456" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-image/README.md b/examples/alicloud-ecs-image/README.md deleted file mode 100644 index a6a76d8e5a..0000000000 --- a/examples/alicloud-ecs-image/README.md +++ /dev/null @@ -1,27 +0,0 @@ -### ECS Example - -The example gains image info and use it to launche ECS instance, disk, and attached the disk on ECS. the count parameter in variables.tf can let you gain specify image and use it to create specify number ECS instances. - -### Get up and running - -* Planning phase - - terraform plan - var.availability_zones - Enter a value: {var.availability_zones} /*cn-beijing-b*/ - var.datacenter - Enter a value: {datacenter} - .... - -* Apply phase - - terraform apply - var.availability_zones - Enter a value: {var.availability_zones} /*cn-beijing-b*/ - var.datacenter - Enter a value: {datacenter} - .... - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-ecs-image/main.tf b/examples/alicloud-ecs-image/main.tf deleted file mode 100644 index 04efe08ed2..0000000000 --- a/examples/alicloud-ecs-image/main.tf +++ /dev/null @@ -1,88 +0,0 @@ -data "alicloud_images" "ecs_image" { - most_recent = "${var.most_recent}" - owners = "${var.image_owners}" - name_regex = "${var.name_regex}" -} - -resource "alicloud_security_group" "group" { - name = "${var.short_name}" - description = "New security group" -} - -resource "alicloud_security_group_rule" "http-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "80/80" - priority = 1 - security_group_id = "${alicloud_security_group.group.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_security_group_rule" "https-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "443/443" - priority = 1 - security_group_id = "${alicloud_security_group.group.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_security_group_rule" "ssh-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "22/22" - priority = 1 - security_group_id = "${alicloud_security_group.group.id}" - cidr_ip = "0.0.0.0/0" -} - - -resource "alicloud_disk" "disk" { - availability_zone = "${var.availability_zones}" - category = "${var.disk_category}" - size = "${var.disk_size}" - count = "${var.count}" -} - -resource "alicloud_instance" "instance" { - instance_name = "${var.short_name}-${var.role}-${format(var.count_format, count.index+1)}" - host_name = "${var.short_name}-${var.role}-${format(var.count_format, count.index+1)}" - image_id = "${data.alicloud_images.ecs_image.images.0.id}" - instance_type = "${var.ecs_type}" - count = "${var.count}" - availability_zone = "${var.availability_zones}" - security_groups = ["${alicloud_security_group.group.*.id}"] - - internet_charge_type = "${var.internet_charge_type}" - internet_max_bandwidth_out = "${var.internet_max_bandwidth_out}" - - io_optimized = "${var.io_optimized}" - - password = "${var.ecs_password}" - - allocate_public_ip = "${var.allocate_public_ip}" - - instance_charge_type = "PostPaid" - system_disk_category = "cloud_efficiency" - - - tags { - role = "${var.role}" - dc = "${var.datacenter}" - } - -} - -resource "alicloud_disk_attachment" "instance-attachment" { - count = "${var.count}" - disk_id = "${element(alicloud_disk.disk.*.id, count.index)}" - instance_id = "${element(alicloud_instance.instance.*.id, count.index)}" - device_name = "${var.device_name}" -} - diff --git a/examples/alicloud-ecs-image/outputs.tf b/examples/alicloud-ecs-image/outputs.tf deleted file mode 100644 index 104f2389fc..0000000000 --- a/examples/alicloud-ecs-image/outputs.tf +++ /dev/null @@ -1,15 +0,0 @@ -output "hostname_list" { - value = "${join(",", alicloud_instance.instance.*.instance_name)}" -} - -output "ecs_ids" { - value = "${join(",", alicloud_instance.instance.*.id)}" -} - -output "ecs_public_ip" { - value = "${join(",", alicloud_instance.instance.*.public_ip)}" -} - -output "tags" { - value = "${jsonencode(alicloud_instance.instance.tags)}" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-image/variables.tf b/examples/alicloud-ecs-image/variables.tf deleted file mode 100644 index 35007e8c80..0000000000 --- a/examples/alicloud-ecs-image/variables.tf +++ /dev/null @@ -1,57 +0,0 @@ -variable "count" { - default = "1" -} -variable "count_format" { - default = "%02d" -} -variable "most_recent" { - default = true -} - -variable "image_owners" { - default = "" -} - -variable "name_regex" { - default = "^centos_6\\w{1,5}[64].*" -} - -variable "role" { - default = "work" -} -variable "datacenter" { - default = "beijing" -} -variable "short_name" { - default = "hi" -} -variable "ecs_type" { - default = "ecs.n1.small" -} -variable "ecs_password" { - default = "Test12345" -} -variable "availability_zones" { - default = "cn-beijing-b" -} -variable "allocate_public_ip" { - default = true -} -variable "internet_charge_type" { - default = "PayByTraffic" -} -variable "internet_max_bandwidth_out" { - default = 5 -} -variable "io_optimized" { - default = "optimized" -} -variable "disk_category" { - default = "cloud_ssd" -} -variable "disk_size" { - default = "40" -} -variable "device_name" { - default = "/dev/xvdb" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-nat/README.md b/examples/alicloud-ecs-nat/README.md deleted file mode 100644 index 123faebd01..0000000000 --- a/examples/alicloud-ecs-nat/README.md +++ /dev/null @@ -1,33 +0,0 @@ -### Configure NAT instance Example - -In the Virtual Private Cloud(VPC) environment, to enable multiple back-end intranet hosts to provide services externally with a limited number of EIPs, map the ports on the EIP-bound host to the back-end intranet hosts. - -### Get up and running - -* Planning phase - - terraform plan - -* Apply phase - - terraform apply - - Get the outputs: - + nat_instance_eip_address = 123.56.19.238 - + nat_instance_private_ip = 10.1.1.57 - + worker_instance_private_ip = 10.1.1.56 - -* Apply phase - - + login the vm: ssh root@123.56.19.238|Test123456 - + Run the "iptables -t nat -nvL" command to check the result - - | prot | in | source | destination | | - | ---- | -- | ----------- | -------------- | ------------------------ | - | tcp | * | 0.0.0.0/0 | 10.1.1.57 | tcp dpt:80 to:10.1.1.56 - | all | * | 10.1.1.0/24 | 0.0.0.0/0 | to:10.1.1.57 - - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-ecs-nat/main.tf b/examples/alicloud-ecs-nat/main.tf deleted file mode 100644 index 300f097460..0000000000 --- a/examples/alicloud-ecs-nat/main.tf +++ /dev/null @@ -1,98 +0,0 @@ -resource "alicloud_vpc" "main" { - cidr_block = "${var.vpc_cidr}" -} - -resource "alicloud_vswitch" "main" { - vpc_id = "${alicloud_vpc.main.id}" - cidr_block = "${var.vswitch_cidr}" - availability_zone = "${var.zone}" - depends_on = ["alicloud_vpc.main"] -} - -resource "alicloud_route_entry" "entry" { - router_id = "${alicloud_vpc.main.router_id}" - route_table_id = "${alicloud_vpc.main.router_table_id}" - destination_cidrblock = "0.0.0.0/0" - nexthop_type = "Instance" - nexthop_id = "${alicloud_instance.nat.id}" -} - -resource "alicloud_instance" "nat" { - image_id = "${var.image}" - instance_type = "${var.instance_nat_type}" - availability_zone = "${var.zone}" - security_groups = ["${alicloud_security_group.group.id}"] - vswitch_id = "${alicloud_vswitch.main.id}" - instance_name = "nat" - io_optimized = "optimized" - system_disk_category = "cloud_efficiency" - password= "${var.instance_pwd}" - - depends_on = ["alicloud_instance.worker"] - user_data = "${data.template_file.shell.rendered}" - - tags { - Name = "ecs-nat" - } -} - -data "template_file" "shell" { - template = "${file("userdata.sh")}" - - vars { - worker_private_ip = "${alicloud_instance.worker.private_ip}" - vswitch_cidr = "${var.vswitch_cidr}" - } -} - -resource "alicloud_instance" "worker" { - image_id = "${var.image}" - instance_type = "${var.instance_worker_type}" - availability_zone = "${var.zone}" - security_groups = ["${alicloud_security_group.group.id}"] - vswitch_id = "${alicloud_vswitch.main.id}" - instance_name = "worker" - io_optimized = "optimized" - system_disk_category = "cloud_efficiency" - password= "${var.instance_pwd}" - - tags { - Name = "ecs-worker" - } -} - -resource "alicloud_eip" "eip" { -} - -resource "alicloud_eip_association" "attach" { - allocation_id = "${alicloud_eip.eip.id}" - instance_id = "${alicloud_instance.nat.id}" -} - -resource "alicloud_security_group" "group" { - name = "terraform-test-group" - description = "New security group" - vpc_id = "${alicloud_vpc.main.id}" -} - -resource "alicloud_security_group_rule" "allow_in" { - security_group_id = "${alicloud_security_group.group.id}" - type = "ingress" - cidr_ip= "0.0.0.0/0" - policy = "accept" - ip_protocol= "all" - nic_type= "intranet" - port_range= "-1/-1" - priority= 1 -} - -resource "alicloud_security_group_rule" "allow_out" { - security_group_id = "${alicloud_security_group.group.id}" - type = "egress" - cidr_ip= "0.0.0.0/0" - policy = "accept" - ip_protocol= "all" - nic_type= "intranet" - port_range= "-1/-1" - priority= 1 -} \ No newline at end of file diff --git a/examples/alicloud-ecs-nat/outputs.tf b/examples/alicloud-ecs-nat/outputs.tf deleted file mode 100644 index 46632334de..0000000000 --- a/examples/alicloud-ecs-nat/outputs.tf +++ /dev/null @@ -1,19 +0,0 @@ -output "nat_instance_id" { - value = "${alicloud_instance.nat.id}" -} - -output "nat_instance_private_ip" { - value = "${alicloud_instance.nat.private_ip}" -} - -output "nat_instance_eip_address" { - value = "${alicloud_eip.eip.ip_address}" -} - -output "worker_instance_id" { - value = "${alicloud_instance.worker.id}" -} - -output "worker_instance_private_ip" { - value = "${alicloud_instance.worker.private_ip}" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-nat/userdata.sh b/examples/alicloud-ecs-nat/userdata.sh deleted file mode 100644 index 6cf1f45360..0000000000 --- a/examples/alicloud-ecs-nat/userdata.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -PostRouting=${vswitch_cidr} -SourceRouting=`ifconfig eth0|grep inet|awk '{print $2}'|tr -d 'addr:'` -echo ${worker_private_ip}>> /etc/sysctl.conf -echo 'net.ipv4.ip_forward=1'>> /etc/sysctl.conf -sysctl -p -iptables -t nat -I POSTROUTING -s $PostRouting -j SNAT --to-source $SourceRouting -iptables -t nat -I PREROUTING -d $SourceRouting -p tcp --dport 80 -j DNAT --to ${worker_private_ip} \ No newline at end of file diff --git a/examples/alicloud-ecs-nat/variables.tf b/examples/alicloud-ecs-nat/variables.tf deleted file mode 100644 index 2ccec3d1af..0000000000 --- a/examples/alicloud-ecs-nat/variables.tf +++ /dev/null @@ -1,27 +0,0 @@ -variable "vpc_cidr" { - default = "10.1.0.0/21" -} - -variable "vswitch_cidr" { - default = "10.1.1.0/24" -} - -variable "zone" { - default = "cn-beijing-c" -} - -variable "image" { - default = "ubuntu_140405_64_40G_cloudinit_20161115.vhd" -} - -variable "instance_nat_type" { - default = "ecs.n1.small" -} - -variable "instance_worker_type" { - default = "ecs.s2.large" -} - -variable "instance_pwd" { - default = "Test123456" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-slb/README.md b/examples/alicloud-ecs-slb/README.md deleted file mode 100644 index 91c5855512..0000000000 --- a/examples/alicloud-ecs-slb/README.md +++ /dev/null @@ -1,18 +0,0 @@ -### ECS With SLB Example - -The example launches ECS, disk, and attached the disk on ECS. It also creates an SLB, and addition the ECS to backendServer. The variables.tf can let you create specify parameter instances, such as image_id, ecs_type etc. - -### Get up and running - -* Planning phase - - terraform plan - -* Apply phase - - terraform apply - - -* Destroy - - terraform destroy diff --git a/examples/alicloud-ecs-slb/main.tf b/examples/alicloud-ecs-slb/main.tf deleted file mode 100644 index 8e6b9a659f..0000000000 --- a/examples/alicloud-ecs-slb/main.tf +++ /dev/null @@ -1,79 +0,0 @@ -resource "alicloud_security_group" "group" { - name = "${var.short_name}" - description = "New security group" -} - -resource "alicloud_security_group_rule" "http-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "80/80" - priority = 1 - security_group_id = "${alicloud_security_group.group.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_security_group_rule" "https-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "443/443" - priority = 1 - security_group_id = "${alicloud_security_group.group.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_security_group_rule" "ssh-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "22/22" - priority = 1 - security_group_id = "${alicloud_security_group.group.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_instance" "instance" { - instance_name = "${var.short_name}-${var.role}-${format(var.count_format, count.index+1)}" - host_name = "${var.short_name}-${var.role}-${format(var.count_format, count.index+1)}" - image_id = "${var.image_id}" - instance_type = "${var.ecs_type}" - count = "${var.count}" - security_groups = ["${alicloud_security_group.group.*.id}"] - internet_charge_type = "${var.internet_charge_type}" - internet_max_bandwidth_out = "${var.internet_max_bandwidth_out}" - io_optimized = "${var.io_optimized}" - password = "${var.ecs_password}" - allocate_public_ip = "${var.allocate_public_ip}" - availability_zone = "" - instance_charge_type = "PostPaid" - system_disk_category = "cloud_efficiency" - - tags { - role = "${var.role}" - dc = "${var.datacenter}" - } -} - -resource "alicloud_slb" "instance" { - name = "${var.slb_name}" - internet_charge_type = "${var.slb_internet_charge_type}" - internet = "${var.internet}" - - listener = [ - { - "instance_port" = "2111" - "lb_port" = "21" - "lb_protocol" = "tcp" - "bandwidth" = "5" - }] -} - - -resource "alicloud_slb_attachment" "default" { - slb_id = "${alicloud_slb.instance.id}" - instances = ["${alicloud_instance.instance.*.id}"] -} \ No newline at end of file diff --git a/examples/alicloud-ecs-slb/outputs.tf b/examples/alicloud-ecs-slb/outputs.tf deleted file mode 100644 index 9c7d3800ee..0000000000 --- a/examples/alicloud-ecs-slb/outputs.tf +++ /dev/null @@ -1,20 +0,0 @@ -output "slb_id" { - value = "${alicloud_slb.instance.id}" -} - -output "slbname" { - value = "${alicloud_slb.instance.name}" -} - -output "hostname_list" { - value = "${join(",", alicloud_instance.instance.*.instance_name)}" -} - -output "ecs_ids" { - value = "${join(",", alicloud_instance.instance.*.id)}" -} - -output "slb_backendserver" { - value = "${alicloud_slb_attachment.default.backend_servers}" -} - diff --git a/examples/alicloud-ecs-slb/variables.tf b/examples/alicloud-ecs-slb/variables.tf deleted file mode 100644 index 20896631a2..0000000000 --- a/examples/alicloud-ecs-slb/variables.tf +++ /dev/null @@ -1,58 +0,0 @@ -variable "count" { - default = "1" -} -variable "count_format" { - default = "%02d" -} -variable "image_id" { - default = "ubuntu_140405_64_40G_cloudinit_20161115.vhd" -} - -variable "role" { - default = "worder" -} -variable "datacenter" { - default = "beijing" -} -variable "short_name" { - default = "hi" -} -variable "ecs_type" { - default = "ecs.n1.small" -} -variable "ecs_password" { - default = "Test12345" -} -variable "availability_zones" { - default = "cn-beijing-b" -} -variable "ssh_username" { - default = "root" -} - -variable "allocate_public_ip" { - default = true -} - -variable "internet_charge_type" { - default = "PayByTraffic" -} - -variable "slb_internet_charge_type" { - default = "paybytraffic" -} -variable "internet_max_bandwidth_out" { - default = 5 -} - -variable "io_optimized" { - default = "optimized" -} - -variable "slb_name" { - default = "slb_worder" -} - -variable "internet" { - default = true -} diff --git a/examples/alicloud-ecs-special-sg/README.md b/examples/alicloud-ecs-special-sg/README.md deleted file mode 100644 index 6e9e482a9f..0000000000 --- a/examples/alicloud-ecs-special-sg/README.md +++ /dev/null @@ -1,20 +0,0 @@ -### ECS With special SLB and SecurityGroup Example - -The example launches 6 ECS and create it on special SLB and securityGroup. -Also additional first and second instance to the SLB backend server. -The variables.tf can let you create specify parameter instances, such as image_id, ecs_type etc. - -### Get up and running - -* Planning phase - - terraform plan - -* Apply phase - - terraform apply - - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-ecs-special-sg/main.tf b/examples/alicloud-ecs-special-sg/main.tf deleted file mode 100644 index ba92486a6d..0000000000 --- a/examples/alicloud-ecs-special-sg/main.tf +++ /dev/null @@ -1,39 +0,0 @@ -provider "alicloud" { - alias = "bj" - region = "cn-beijing" -} - -resource "alicloud_instance" "instance" { - provider = "alicloud.bj" - instance_name = "website-${format(var.count_format, count.index+1)}" - host_name = "website-${format(var.count_format, count.index+1)}" - image_id = "centos7u2_64_40G_cloudinit_20160728.raw" - instance_type = "ecs.s2.large" - count = "6" - availability_zone = "cn-beijing-b" - security_groups = "${var.security_groups}" - - internet_charge_type = "PayByBandwidth" - - io_optimized = "none" - - password = "${var.ecs_password}" - - allocate_public_ip = "false" - - instance_charge_type = "PostPaid" - system_disk_category = "cloud" - - - tags { - env = "prod" - product = "website" - dc = "beijing" - } - -} - -resource "alicloud_slb_attachment" "foo" { - slb_id = "${var.slb_id}" - instances = ["${alicloud_instance.instance.0.id}", "${alicloud_instance.instance.1.id}"] -} \ No newline at end of file diff --git a/examples/alicloud-ecs-special-sg/outputs.tf b/examples/alicloud-ecs-special-sg/outputs.tf deleted file mode 100644 index 33cb4a7e8f..0000000000 --- a/examples/alicloud-ecs-special-sg/outputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "hostname_list" { - value = "${join(",", alicloud_instance.instance.*.instance_name)}" -} - -output "ecs_ids" { - value = "${join(",", alicloud_instance.instance.*.id)}" -} diff --git a/examples/alicloud-ecs-special-sg/variables.tf b/examples/alicloud-ecs-special-sg/variables.tf deleted file mode 100644 index 694b8000fd..0000000000 --- a/examples/alicloud-ecs-special-sg/variables.tf +++ /dev/null @@ -1,17 +0,0 @@ -variable "count" { - default = "6" -} -variable "count_format" { - default = "%02d" -} - -variable "security_groups" { - type = "list" - default = ["sg-2zecd09tw30jo1c7ekdi"] -} -variable "ecs_password" { - default = "Test12345" -} -variable "slb_id"{ - default = "lb-2zel5fjqk1qgmwud7t3xb" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-userdata/README.md b/examples/alicloud-ecs-userdata/README.md deleted file mode 100644 index f58f16c0d9..0000000000 --- a/examples/alicloud-ecs-userdata/README.md +++ /dev/null @@ -1,17 +0,0 @@ -### ECS with UserData Example - -Pass shell scripts to Ecs Instance by user_data parameter. - -### Get up and running - -* Planning phase - - terraform plan - -* Apply phase - - terraform apply - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-ecs-userdata/main.tf b/examples/alicloud-ecs-userdata/main.tf deleted file mode 100644 index b0eacf57dc..0000000000 --- a/examples/alicloud-ecs-userdata/main.tf +++ /dev/null @@ -1,48 +0,0 @@ - -resource "alicloud_vpc" "default" { - name = "tf-vpc" - cidr_block = "${var.vpc_cidr}" -} - -resource "alicloud_vswitch" "vsw" { - vpc_id = "${alicloud_vpc.default.id}" - cidr_block = "${var.vswitch_cidr}" - availability_zone = "${var.zone}" -} - -resource "alicloud_security_group" "sg" { - name = "tf-sg" - description = "sg" - vpc_id = "${alicloud_vpc.default.id}" -} - -resource "alicloud_security_group_rule" "allow_ssh" { - security_group_id = "${alicloud_security_group.sg.id}" - type = "ingress" - cidr_ip= "0.0.0.0/0" - policy = "accept" - ip_protocol= "tcp" - port_range= "22/22" - priority= 1 -} - -resource "alicloud_instance" "website" { - # cn-beijing - availability_zone = "${var.zone}" - vswitch_id = "${alicloud_vswitch.vsw.id}" - image_id = "${var.image}" - - # series II - instance_type = "${var.ecs_type}" - io_optimized = "optimized" - system_disk_category = "cloud_efficiency" - - internet_charge_type = "PayByTraffic" - internet_max_bandwidth_out = 5 - allocate_public_ip = true - security_groups = ["${alicloud_security_group.sg.id}"] - instance_name = "tf_website" - password= "${var.password}" - - user_data = "${file("userdata.sh")}" -} diff --git a/examples/alicloud-ecs-userdata/outputs.tf b/examples/alicloud-ecs-userdata/outputs.tf deleted file mode 100644 index 2034a70161..0000000000 --- a/examples/alicloud-ecs-userdata/outputs.tf +++ /dev/null @@ -1,8 +0,0 @@ - -output "ecs_id" { - value = "${alicloud_instance.website.id}" -} - -output "ecs_public_ip" { - value = "${alicloud_instance.website.public_ip}" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-userdata/userdata.sh b/examples/alicloud-ecs-userdata/userdata.sh deleted file mode 100644 index dba9b88914..0000000000 --- a/examples/alicloud-ecs-userdata/userdata.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -v -apt-get update -y -apt-get install -y nginx > /tmp/nginx.log - -cd / -mkdir -p alicloud/go \ No newline at end of file diff --git a/examples/alicloud-ecs-userdata/variables.tf b/examples/alicloud-ecs-userdata/variables.tf deleted file mode 100644 index 5c54758395..0000000000 --- a/examples/alicloud-ecs-userdata/variables.tf +++ /dev/null @@ -1,23 +0,0 @@ -variable "vpc_cidr" { - default = "172.16.0.0/12" -} - -variable "vswitch_cidr" { - default = "172.16.0.0/21" -} - -variable "zone" { - default = "cn-beijing-b" -} - -variable "password" { - default = "Test123456" -} - -variable "image" { - default = "ubuntu_140405_32_40G_cloudinit_20161115.vhd" -} - -variable "ecs_type" { - default = "ecs.n1.medium" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-vpc-cluster/README.md b/examples/alicloud-ecs-vpc-cluster/README.md deleted file mode 100644 index 62fec8cc0b..0000000000 --- a/examples/alicloud-ecs-vpc-cluster/README.md +++ /dev/null @@ -1,19 +0,0 @@ -### VPC Cluster Example - -The example launches VPC cluster, include VPC, VSwitch, Nategateway, ECS, SecurityGroups. the example used the "module" to create instances. The variables.tf can let you create specify parameter instances, such as image_id, ecs_type, count etc. - -### Get up and running - -* Planning phase - - terraform plan - - -* Apply phase - - terraform apply - - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-ecs-vpc-cluster/main.tf b/examples/alicloud-ecs-vpc-cluster/main.tf deleted file mode 100644 index 5d0ef7b819..0000000000 --- a/examples/alicloud-ecs-vpc-cluster/main.tf +++ /dev/null @@ -1,53 +0,0 @@ - -module "vpc" { - availability_zones = "${var.availability_zones}" - source = "../alicloud-vpc" - short_name = "${var.short_name}" - region = "${var.region}" -} - -module "security-groups" { - source = "../alicloud-vpc-cluster-sg" - short_name = "${var.short_name}" - vpc_id = "${module.vpc.vpc_id}" -} - -module "control-nodes" { - source = "../alicloud-ecs-vpc" - count = "${var.control_count}" - role = "control" - datacenter = "${var.datacenter}" - ecs_type = "${var.control_ecs_type}" - disk_size = "${var.control_disk_size}" - ssh_username = "${var.ssh_username}" - short_name = "${var.short_name}" - availability_zones = "${module.vpc.availability_zones}" - security_groups = ["${module.security-groups.control_security_group}"] - vswitch_id = "${module.vpc.vswitch_ids}" -} - -module "edge-nodes" { - source = "../alicloud-ecs-vpc" - count = "${var.edge_count}" - role = "edge" - datacenter = "${var.datacenter}" - ecs_type = "${var.edge_ecs_type}" - ssh_username = "${var.ssh_username}" - short_name = "${var.short_name}" - availability_zones = "${module.vpc.availability_zones}" - security_groups = ["${module.security-groups.worker_security_group}"] - vswitch_id = "${module.vpc.vswitch_ids}" -} - -module "worker-nodes" { - source = "../alicloud-ecs-vpc" - count = "${var.worker_count}" - role = "worker" - datacenter = "${var.datacenter}" - ecs_type = "${var.worker_ecs_type}" - ssh_username = "${var.ssh_username}" - short_name = "${var.short_name}" - availability_zones = "${module.vpc.availability_zones}" - security_groups = ["${module.security-groups.worker_security_group}"] - vswitch_id = "${module.vpc.vswitch_ids}" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-vpc-cluster/variables.tf b/examples/alicloud-ecs-vpc-cluster/variables.tf deleted file mode 100644 index 4df8f7b4df..0000000000 --- a/examples/alicloud-ecs-vpc-cluster/variables.tf +++ /dev/null @@ -1,55 +0,0 @@ -variable "ecs_password" { - default = "Test12345" -} - -variable "control_count" { - default = "3" -} -variable "control_count_format" { - default = "%02d" -} -variable "control_ecs_type" { - default = "ecs.n1.medium" -} -variable "control_disk_size" { - default = "100" -} - -variable "edge_count" { - default = "2" -} -variable "edge_count_format" { - default = "%02d" -} -variable "edge_ecs_type" { - default = "ecs.n1.small" -} - -variable "worker_count" { - default = "1" -} -variable "worker_count_format" { - default = "%03d" -} -variable "worker_ecs_type" { - default = "ecs.n1.small" -} - -variable "short_name" { - default = "ali" -} -variable "ssh_username" { - default = "root" -} - -variable "region" { - default = "cn-beijing" -} - -variable "availability_zones" { - default = "cn-beijing-c" -} - -variable "datacenter" { - default = "beijing" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-vpc/README.md b/examples/alicloud-ecs-vpc/README.md deleted file mode 100644 index bfc92c494c..0000000000 --- a/examples/alicloud-ecs-vpc/README.md +++ /dev/null @@ -1,31 +0,0 @@ -### ECS In VPC Example - -The example launches ECS in VPC, vswitch_id parameter is the vswitch id from VPC. It also create disk, and attached the disk on ECS. The variables.tf can let you create specify parameter instances, such as image_id, ecs_type, count etc. - -### Get up and running - -* Planning phase - - terraform plan - var.availability_zones - Enter a value: {var.availability_zones} /*cn-beijing-b*/ - var.datacenter - Enter a value: {datacenter} - var.vswitch_id - Enter a value: {vswitch_id} - .... - -* Apply phase - - terraform apply - var.availability_zones - Enter a value: {var.availability_zones} /*cn-beijing-b*/ - var.datacenter - Enter a value: {datacenter} - var.vswitch_id - Enter a value: {vswitch_id} - .... - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-ecs-vpc/main.tf b/examples/alicloud-ecs-vpc/main.tf deleted file mode 100644 index a4283ccd99..0000000000 --- a/examples/alicloud-ecs-vpc/main.tf +++ /dev/null @@ -1,45 +0,0 @@ -resource "alicloud_disk" "disk" { - availability_zone = "${var.availability_zones}" - category = "${var.disk_category}" - size = "${var.disk_size}" - count = "${var.count}" -} - -resource "alicloud_instance" "instance" { - instance_name = "${var.short_name}-${var.role}-${format(var.count_format, count.index+1)}" - host_name = "${var.short_name}-${var.role}-${format(var.count_format, count.index+1)}" - image_id = "${var.image_id}" - instance_type = "${var.ecs_type}" - count = "${var.count}" - availability_zone = "${var.availability_zones}" - security_groups = ["${var.security_groups}"] - vswitch_id = "${var.vswitch_id}" - - internet_charge_type = "${var.internet_charge_type}" - internet_max_bandwidth_out = "${var.internet_max_bandwidth_out}" - - io_optimized = "${var.io_optimized}" - - allocate_public_ip = "${var.allocate_public_ip}" - - password = "${var.ecs_password}" - - instance_charge_type = "${var.instance_charge_type}" - system_disk_category = "${var.system_disk_category}" - - - tags { - role = "${var.role}" - dc = "${var.datacenter}" - } - -} - -resource "alicloud_disk_attachment" "instance-attachment" { - count = "${var.count}" - disk_id = "${element(alicloud_disk.disk.*.id, count.index)}" - instance_id = "${element(alicloud_instance.instance.*.id, count.index)}" - device_name = "${var.device_name}" -} - - diff --git a/examples/alicloud-ecs-vpc/outputs.tf b/examples/alicloud-ecs-vpc/outputs.tf deleted file mode 100644 index d1b7c8a19d..0000000000 --- a/examples/alicloud-ecs-vpc/outputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "hostname_list" { - value = "${join(",", alicloud_instance.instance.*.instance_name)}" -} - -output "ecs_ids" { - value = "${join(",", alicloud_instance.instance.*.id)}" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-vpc/variables.tf b/examples/alicloud-ecs-vpc/variables.tf deleted file mode 100644 index e3064c15f1..0000000000 --- a/examples/alicloud-ecs-vpc/variables.tf +++ /dev/null @@ -1,68 +0,0 @@ -variable "count" { - default = "1" -} -variable "count_format" { - default = "%02d" -} -variable "image_id" { - default = "ubuntu_140405_64_40G_cloudinit_20161115.vhd" -} - -variable "role" { -} -variable "datacenter" { -} -variable "short_name" { - default = "hi" -} -variable "ecs_type" { -} -variable "ecs_password" { - default = "Test12345" -} -variable "availability_zones" { -} -variable "security_groups" { - type = "list" -} -variable "ssh_username" { - default = "root" -} - -//if instance_charge_type is "PrePaid", then must be set period, the value is 1 to 30, unit is month -variable "instance_charge_type" { - default = "PostPaid" -} - -variable "system_disk_category" { - default = "cloud_efficiency" -} - -variable "internet_charge_type" { - default = "PayByTraffic" -} -variable "internet_max_bandwidth_out" { - default = 5 -} - -variable "io_optimized" { - default = "optimized" -} - -variable "allocate_public_ip" { - default = true -} - -variable "disk_category" { - default = "cloud_ssd" -} -variable "disk_size" { - default = "40" -} -variable "device_name" { - default = "/dev/xvdb" -} - -variable "vswitch_id" { - default = "" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-zone-type/README.md b/examples/alicloud-ecs-zone-type/README.md deleted file mode 100644 index 6f0b462218..0000000000 --- a/examples/alicloud-ecs-zone-type/README.md +++ /dev/null @@ -1,19 +0,0 @@ -### Ecs Instance Type Data Source Example - -The example launches Ecs instance type Data Resource. Then set ecs parameter instance_type refer to the Data Resource config above. - -### Get up and running - -* Planning phase - - terraform plan - - -* Apply phase - - terraform apply - - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-ecs-zone-type/main.tf b/examples/alicloud-ecs-zone-type/main.tf deleted file mode 100644 index 1817781bce..0000000000 --- a/examples/alicloud-ecs-zone-type/main.tf +++ /dev/null @@ -1,75 +0,0 @@ -data "alicloud_instance_types" "1c2g" { - cpu_core_count = 1 - memory_size = 2 - instance_type_family = "ecs.n1" -} - -data "alicloud_zones" "default" { - "available_instance_type"= "${data.alicloud_instance_types.1c2g.instance_types.0.id}" - "available_disk_category"= "${var.disk_category}" -} - -resource "alicloud_security_group" "group" { - name = "${var.short_name}" - description = "New security group" -} - -resource "alicloud_security_group_rule" "http-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "80/80" - priority = 1 - security_group_id = "${alicloud_security_group.group.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_security_group_rule" "https-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "443/443" - priority = 1 - security_group_id = "${alicloud_security_group.group.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_security_group_rule" "ssh-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "22/22" - priority = 1 - security_group_id = "${alicloud_security_group.group.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_instance" "instance" { - instance_name = "${var.short_name}-${var.role}-${format(var.count_format, count.index+1)}" - host_name = "${var.short_name}-${var.role}-${format(var.count_format, count.index+1)}" - image_id = "${var.image_id}" - instance_type = "${data.alicloud_instance_types.1c2g.instance_types.0.id}" - count = "${var.count}" - availability_zone = "${data.alicloud_zones.default.zones.0.id}" - security_groups = ["${alicloud_security_group.group.*.id}"] - - internet_charge_type = "${var.internet_charge_type}" - internet_max_bandwidth_out = "${var.internet_max_bandwidth_out}" - - io_optimized = "${var.io_optimized}" - - password = "${var.ecs_password}" - - instance_charge_type = "PostPaid" - system_disk_category = "${var.disk_category}" - - - tags { - role = "${var.role}" - dc = "${var.datacenter}" - } - -} diff --git a/examples/alicloud-ecs-zone-type/outputs.tf b/examples/alicloud-ecs-zone-type/outputs.tf deleted file mode 100644 index 104f2389fc..0000000000 --- a/examples/alicloud-ecs-zone-type/outputs.tf +++ /dev/null @@ -1,15 +0,0 @@ -output "hostname_list" { - value = "${join(",", alicloud_instance.instance.*.instance_name)}" -} - -output "ecs_ids" { - value = "${join(",", alicloud_instance.instance.*.id)}" -} - -output "ecs_public_ip" { - value = "${join(",", alicloud_instance.instance.*.public_ip)}" -} - -output "tags" { - value = "${jsonencode(alicloud_instance.instance.tags)}" -} \ No newline at end of file diff --git a/examples/alicloud-ecs-zone-type/variables.tf b/examples/alicloud-ecs-zone-type/variables.tf deleted file mode 100644 index 1ba1cb5cc5..0000000000 --- a/examples/alicloud-ecs-zone-type/variables.tf +++ /dev/null @@ -1,35 +0,0 @@ -variable "count" { - default = "1" -} -variable "count_format" { - default = "%02d" -} - -variable "image_id" { - default = "ubuntu_140405_64_40G_cloudinit_20161115.vhd" -} - -variable "disk_category" { - default = "cloud_ssd" -} -variable "role" { - default = "work" -} -variable "datacenter" { - default = "beijing" -} -variable "short_name" { - default = "hi" -} -variable "ecs_password" { - default = "Test12345" -} -variable "internet_charge_type" { - default = "PayByTraffic" -} -variable "internet_max_bandwidth_out" { - default = 5 -} -variable "io_optimized" { - default = "optimized" -} \ No newline at end of file diff --git a/examples/alicloud-ecs/README.md b/examples/alicloud-ecs/README.md deleted file mode 100644 index 88d2887a34..0000000000 --- a/examples/alicloud-ecs/README.md +++ /dev/null @@ -1,27 +0,0 @@ -### ECS Example - -The example launches ECS instance, disk, and attached the disk on ECS. the count parameter in variables.tf can let you create specify number ECS instances. - -### Get up and running - -* Planning phase - - terraform plan - var.availability_zones - Enter a value: {var.availability_zones} /*cn-beijing-b*/ - var.datacenter - Enter a value: {datacenter} - .... - -* Apply phase - - terraform apply - var.availability_zones - Enter a value: {var.availability_zones} /*cn-beijing-b*/ - var.datacenter - Enter a value: {datacenter} - .... - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-ecs/main.tf b/examples/alicloud-ecs/main.tf deleted file mode 100644 index 0ed0779400..0000000000 --- a/examples/alicloud-ecs/main.tf +++ /dev/null @@ -1,76 +0,0 @@ -data "alicloud_instance_types" "instance_type" { - instance_type_family = "ecs.n1" - cpu_core_count = "1" - memory_size = "2" -} - -resource "alicloud_security_group" "group" { - name = "${var.short_name}" - description = "New security group" -} - -resource "alicloud_security_group_rule" "allow_http_80" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "${var.nic_type}" - policy = "accept" - port_range = "80/80" - priority = 1 - security_group_id = "${alicloud_security_group.group.id}" - cidr_ip = "0.0.0.0/0" -} - - -resource "alicloud_security_group_rule" "allow_https_443" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "${var.nic_type}" - policy = "accept" - port_range = "443/443" - priority = 1 - security_group_id = "${alicloud_security_group.group.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_disk" "disk" { - availability_zone = "${alicloud_instance.instance.0.availability_zone}" - category = "${var.disk_category}" - size = "${var.disk_size}" - count = "${var.count}" -} - -resource "alicloud_instance" "instance" { - instance_name = "${var.short_name}-${var.role}-${format(var.count_format, count.index+1)}" - host_name = "${var.short_name}-${var.role}-${format(var.count_format, count.index+1)}" - image_id = "${var.image_id}" - instance_type = "${data.alicloud_instance_types.instance_type.instance_types.0.id}" - count = "${var.count}" - availability_zone = "${var.availability_zones}" - security_groups = ["${alicloud_security_group.group.*.id}"] - - internet_charge_type = "${var.internet_charge_type}" - internet_max_bandwidth_out = "${var.internet_max_bandwidth_out}" - - password = "${var.ecs_password}" - - allocate_public_ip = "${var.allocate_public_ip}" - - io_optimized = "${var.io_optimized}" - - instance_charge_type = "PostPaid" - system_disk_category = "cloud_efficiency" - - - tags { - role = "${var.role}" - dc = "${var.datacenter}" - } - -} - -resource "alicloud_disk_attachment" "instance-attachment" { - count = "${var.count}" - disk_id = "${element(alicloud_disk.disk.*.id, count.index)}" - instance_id = "${element(alicloud_instance.instance.*.id, count.index)}" - device_name = "${var.device_name}" -} \ No newline at end of file diff --git a/examples/alicloud-ecs/outputs.tf b/examples/alicloud-ecs/outputs.tf deleted file mode 100644 index 104f2389fc..0000000000 --- a/examples/alicloud-ecs/outputs.tf +++ /dev/null @@ -1,15 +0,0 @@ -output "hostname_list" { - value = "${join(",", alicloud_instance.instance.*.instance_name)}" -} - -output "ecs_ids" { - value = "${join(",", alicloud_instance.instance.*.id)}" -} - -output "ecs_public_ip" { - value = "${join(",", alicloud_instance.instance.*.public_ip)}" -} - -output "tags" { - value = "${jsonencode(alicloud_instance.instance.tags)}" -} \ No newline at end of file diff --git a/examples/alicloud-ecs/variables.tf b/examples/alicloud-ecs/variables.tf deleted file mode 100644 index dcf479d30d..0000000000 --- a/examples/alicloud-ecs/variables.tf +++ /dev/null @@ -1,56 +0,0 @@ -variable "count" { - default = "1" -} -variable "count_format" { - default = "%02d" -} -variable "image_id" { - default = "ubuntu_140405_64_40G_cloudinit_20161115.vhd" -} - -variable "availability_zones" { - default = "" -} - -variable "role" { - default = "work" -} -variable "datacenter" { - default = "beijing" -} -variable "short_name" { - default = "hi" -} -variable "ecs_type" { - default = "ecs.n1.small" -} -variable "ecs_password" { - default = "Test12345" -} -variable "allocate_public_ip" { - default = true -} -variable "internet_charge_type" { - default = "PayByTraffic" -} -variable "internet_max_bandwidth_out" { - default = 5 -} - -variable "io_optimized" { - default = "optimized" -} - -variable "disk_category" { - default = "cloud_efficiency" -} -variable "disk_size" { - default = "40" -} -variable "device_name" { - default = "/dev/xvdb" -} - -variable "nic_type" { - default = "internet" -} \ No newline at end of file diff --git a/examples/alicloud-ess-scaling/README.md b/examples/alicloud-ess-scaling/README.md deleted file mode 100644 index 3d9d2abb3e..0000000000 --- a/examples/alicloud-ess-scaling/README.md +++ /dev/null @@ -1,17 +0,0 @@ -### ESS scaling configuration Example - -The example launches ESS scaling configuration, will create ECS instance automatic by system schedule. - -### Get up and running - -* Planning phase - - terraform plan - -* Apply phase - - terraform apply - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-ess-scaling/main.tf b/examples/alicloud-ess-scaling/main.tf deleted file mode 100644 index 0f7575bc9e..0000000000 --- a/examples/alicloud-ess-scaling/main.tf +++ /dev/null @@ -1,38 +0,0 @@ -data "alicloud_images" "ecs_image" { - most_recent = true - name_regex = "^centos_6\\w{1,5}[64].*" -} - -resource "alicloud_security_group" "sg" { - name = "${var.security_group_name}" - description = "tf-sg" -} - -resource "alicloud_security_group_rule" "ssh-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "22/22" - priority = 1 - security_group_id = "${alicloud_security_group.sg.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_ess_scaling_group" "scaling" { - min_size = "${var.scaling_min_size}" - max_size = "${var.scaling_max_size}" - scaling_group_name = "tf-scaling" - removal_policies = "${var.removal_policies}" - -} - -resource "alicloud_ess_scaling_configuration" "config" { - scaling_group_id = "${alicloud_ess_scaling_group.scaling.id}" - enable = "${var.enable}" - - image_id = "${data.alicloud_images.ecs_image.images.0.id}" - instance_type = "${var.ecs_instance_type}" - io_optimized = "optimized" - security_group_id = "${alicloud_security_group.sg.id}" -} \ No newline at end of file diff --git a/examples/alicloud-ess-scaling/outputs.tf b/examples/alicloud-ess-scaling/outputs.tf deleted file mode 100644 index c4bfbb73e8..0000000000 --- a/examples/alicloud-ess-scaling/outputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "scaling_group_id" { - value = "${alicloud_ess_scaling_group.scaling.id}" -} - -output "configuration_id" { - value = "${alicloud_ess_scaling_configuration.config.id}" -} \ No newline at end of file diff --git a/examples/alicloud-ess-scaling/variables.tf b/examples/alicloud-ess-scaling/variables.tf deleted file mode 100644 index 11d2ef5673..0000000000 --- a/examples/alicloud-ess-scaling/variables.tf +++ /dev/null @@ -1,24 +0,0 @@ -variable "security_group_name" { - default = "tf-sg" -} - -variable "scaling_min_size" { - default = 1 -} - -variable "scaling_max_size" { - default = 1 -} - -variable "enable" { - default = true -} - -variable "removal_policies" { - type = "list" - default = ["OldestInstance", "NewestInstance"] -} - -variable "ecs_instance_type" { - default = "ecs.s2.large" -} \ No newline at end of file diff --git a/examples/alicloud-ess-schedule/README.md b/examples/alicloud-ess-schedule/README.md deleted file mode 100644 index e606951b10..0000000000 --- a/examples/alicloud-ess-schedule/README.md +++ /dev/null @@ -1,17 +0,0 @@ -### ESS scaling schedule Example - -The example launches ESS schedule task, which will create ECS by the schedule time. - -### Get up and running - -* Planning phase - - terraform plan - -* Apply phase - - terraform apply - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-ess-schedule/main.tf b/examples/alicloud-ess-schedule/main.tf deleted file mode 100644 index 339ba670b5..0000000000 --- a/examples/alicloud-ess-schedule/main.tf +++ /dev/null @@ -1,51 +0,0 @@ -data "alicloud_images" "ecs_image" { - most_recent = true - name_regex = "^centos_6\\w{1,5}[64].*" -} - -resource "alicloud_security_group" "sg" { - name = "${var.security_group_name}" - description = "tf-sg" -} - -resource "alicloud_security_group_rule" "ssh-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "22/22" - priority = 1 - security_group_id = "${alicloud_security_group.sg.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_ess_scaling_group" "scaling" { - min_size = "${var.scaling_min_size}" - max_size = "${var.scaling_max_size}" - scaling_group_name = "tf-scaling" - removal_policies = "${var.removal_policies}" - -} - -resource "alicloud_ess_scaling_configuration" "config" { - scaling_group_id = "${alicloud_ess_scaling_group.scaling.id}" - enable = "${var.enable}" - - image_id = "${data.alicloud_images.ecs_image.images.0.id}" - instance_type = "${var.ecs_instance_type}" - io_optimized = "optimized" - security_group_id = "${alicloud_security_group.sg.id}" -} - -resource "alicloud_ess_scaling_rule" "rule" { - scaling_group_id = "${alicloud_ess_scaling_group.scaling.id}" - adjustment_type = "TotalCapacity" - adjustment_value = "${var.rule_adjust_size}" - cooldown = 60 -} - -resource "alicloud_ess_schedule" "run" { - scheduled_action = "${alicloud_ess_scaling_rule.rule.ari}" - launch_time = "${var.schedule_launch_time}" - scheduled_task_name = "tf-run" -} \ No newline at end of file diff --git a/examples/alicloud-ess-schedule/outputs.tf b/examples/alicloud-ess-schedule/outputs.tf deleted file mode 100644 index 1d48aabfd3..0000000000 --- a/examples/alicloud-ess-schedule/outputs.tf +++ /dev/null @@ -1,11 +0,0 @@ -output "scaling_group_id" { - value = "${alicloud_ess_scaling_group.scaling.id}" -} - -output "configuration_id" { - value = "${alicloud_ess_scaling_configuration.config.id}" -} - -output "configuration_ari" { - value = "${alicloud_ess_scaling_configuration.config.ari}" -} \ No newline at end of file diff --git a/examples/alicloud-ess-schedule/variables.tf b/examples/alicloud-ess-schedule/variables.tf deleted file mode 100644 index fb95b6bee8..0000000000 --- a/examples/alicloud-ess-schedule/variables.tf +++ /dev/null @@ -1,32 +0,0 @@ -variable "security_group_name" { - default = "tf-sg" -} - -variable "scaling_min_size" { - default = 1 -} - -variable "scaling_max_size" { - default = 1 -} - -variable "enable" { - default = true -} - -variable "removal_policies" { - type = "list" - default = ["OldestInstance", "NewestInstance"] -} - -variable "ecs_instance_type" { - default = "ecs.s2.large" -} - -variable "rule_adjust_size" { - default = 3 -} - -variable "schedule_launch_time" { - default = "2017-04-01T01:59Z" -} \ No newline at end of file diff --git a/examples/alicloud-rds/README.md b/examples/alicloud-rds/README.md deleted file mode 100644 index c7b2d09d4d..0000000000 --- a/examples/alicloud-rds/README.md +++ /dev/null @@ -1,17 +0,0 @@ -### RDS Example - -The example launches RDS instance, database, account and grant the database readwrite privilege to the account. - -### Get up and running - -* Planning phase - - terraform plan - -* Apply phase - - terraform apply - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-rds/main.tf b/examples/alicloud-rds/main.tf deleted file mode 100644 index 582bd9739c..0000000000 --- a/examples/alicloud-rds/main.tf +++ /dev/null @@ -1,17 +0,0 @@ - -resource "alicloud_db_instance" "dc" { - engine = "${var.engine}" - engine_version = "${var.engine_version}" - db_instance_class = "${var.instance_class}" - db_instance_storage = "${var.storage}" - db_instance_net_type = "${var.net_type}" - - master_user_name = "${var.user_name}" - master_user_password = "${var.password}" - - db_mappings = [{ - db_name = "${var.database_name}" - character_set_name = "${var.database_character}" - db_description = "tf" - }] -} \ No newline at end of file diff --git a/examples/alicloud-rds/outputs.tf b/examples/alicloud-rds/outputs.tf deleted file mode 100644 index 26c452f924..0000000000 --- a/examples/alicloud-rds/outputs.tf +++ /dev/null @@ -1,11 +0,0 @@ -output "port" { - value = "${alicloud_db_instance.dc.port}" -} - -output "connections" { - value = "${alicloud_db_instance.dc.connections}" -} - -output "security_ips" { - value = "${alicloud_db_instance.dc.security_ips}" -} \ No newline at end of file diff --git a/examples/alicloud-rds/variables.tf b/examples/alicloud-rds/variables.tf deleted file mode 100644 index 81491c4567..0000000000 --- a/examples/alicloud-rds/variables.tf +++ /dev/null @@ -1,29 +0,0 @@ -variable "engine" { - default = "MySQL" -} -variable "engine_version" { - default = "5.6" -} -variable "instance_class" { - default = "rds.mysql.t1.small" -} -variable "storage" { - default = "10" -} -variable "net_type" { - default = "Intranet" -} - -variable "user_name" { - default = "tf_tester" -} -variable "password" { - default = "Test12345" -} - -variable "database_name" { - default = "bookstore" -} -variable "database_character" { - default = "utf8" -} \ No newline at end of file diff --git a/examples/alicloud-security-group-rule/main.tf b/examples/alicloud-security-group-rule/main.tf deleted file mode 100644 index 0f4d1bd0e9..0000000000 --- a/examples/alicloud-security-group-rule/main.tf +++ /dev/null @@ -1,25 +0,0 @@ -resource "alicloud_security_group" "default" { - name = "${var.security_group_name}" -} - -resource "alicloud_security_group_rule" "http-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "80/80" - priority = 1 - security_group_id = "${alicloud_security_group.default.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_security_group_rule" "ssh-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "22/22" - priority = 1 - security_group_id = "${alicloud_security_group.default.id}" - cidr_ip = "0.0.0.0/0" -} \ No newline at end of file diff --git a/examples/alicloud-security-group-rule/outputs.tf b/examples/alicloud-security-group-rule/outputs.tf deleted file mode 100644 index 79ab88b6db..0000000000 --- a/examples/alicloud-security-group-rule/outputs.tf +++ /dev/null @@ -1,15 +0,0 @@ -output "rule_id" { - value = "${alicloud_security_group_rule.allow_all_tcp.id}" -} - -output "rule_type" { - value = "${alicloud_security_group_rule.allow_all_tcp.type}" -} - -output "port_range" { - value = "${alicloud_security_group_rule.allow_all_tcp.port_range}" -} - -output "ip_protocol" { - value = "${alicloud_security_group_rule.allow_all_tcp.ip_protocol}" -} \ No newline at end of file diff --git a/examples/alicloud-security-group-rule/variables.tf b/examples/alicloud-security-group-rule/variables.tf deleted file mode 100644 index 91aa57d4b6..0000000000 --- a/examples/alicloud-security-group-rule/variables.tf +++ /dev/null @@ -1,7 +0,0 @@ -variable "security_group_name" { - default = "default-sg" -} - -variable "nic_type" { - default = "internet" -} \ No newline at end of file diff --git a/examples/alicloud-security-group/README.md b/examples/alicloud-security-group/README.md deleted file mode 100644 index b54db7ad25..0000000000 --- a/examples/alicloud-security-group/README.md +++ /dev/null @@ -1,19 +0,0 @@ -### SecurityGroup With Vpc Example - -The example create SecurityGroup for specify VPC. - -### Get up and running - -* Planning phase - - terraform plan - - -* Apply phase - - terraform apply - - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-security-group/main.tf b/examples/alicloud-security-group/main.tf deleted file mode 100644 index afdf0577f2..0000000000 --- a/examples/alicloud-security-group/main.tf +++ /dev/null @@ -1,5 +0,0 @@ -resource "alicloud_security_group" "group" { - name = "${var.short_name}" - description = "New security group" - vpc_id = "${var.vpc_id}" -} diff --git a/examples/alicloud-security-group/outputs.tf b/examples/alicloud-security-group/outputs.tf deleted file mode 100644 index bd67a462f4..0000000000 --- a/examples/alicloud-security-group/outputs.tf +++ /dev/null @@ -1,3 +0,0 @@ -output "security_group" { - value = "${alicloud_security_group.group.id}" -} \ No newline at end of file diff --git a/examples/alicloud-security-group/variables.tf b/examples/alicloud-security-group/variables.tf deleted file mode 100644 index e37d4e0d23..0000000000 --- a/examples/alicloud-security-group/variables.tf +++ /dev/null @@ -1,4 +0,0 @@ -variable "short_name" { -} -variable "vpc_id" { -} diff --git a/examples/alicloud-slb-vpc/README.md b/examples/alicloud-slb-vpc/README.md deleted file mode 100644 index 809ed9589c..0000000000 --- a/examples/alicloud-slb-vpc/README.md +++ /dev/null @@ -1,19 +0,0 @@ -### SLB With VPC Example - -The example create SLB in special VPC, The variables.tf can let you create specify parameter instances, such as vpc_id, vswitch_id. - -### Get up and running - -* Planning phase - - terraform plan - - -* Apply phase - - terraform apply - - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-slb-vpc/main.tf b/examples/alicloud-slb-vpc/main.tf deleted file mode 100644 index c54d16d005..0000000000 --- a/examples/alicloud-slb-vpc/main.tf +++ /dev/null @@ -1,27 +0,0 @@ -resource "alicloud_vpc" "main" { - name = "${var.long_name}" - cidr_block = "${var.vpc_cidr}" -} - -resource "alicloud_vswitch" "main" { - vpc_id = "${alicloud_vpc.main.id}" - count = "${length(split(",", var.availability_zones))}" - cidr_block = "${lookup(var.cidr_blocks, "az${count.index}")}" - availability_zone = "${element(split(",", var.availability_zones), count.index)}" - depends_on = [ - "alicloud_vpc.main"] -} - -resource "alicloud_slb" "instance" { - name = "${var.name}" - vswitch_id = "${alicloud_vswitch.main.id}" - internet_charge_type = "${var.internet_charge_type}" - listener = [ - { - "instance_port" = "2111" - "lb_port" = "21" - "lb_protocol" = "tcp" - "bandwidth" = "5" - }] -} - diff --git a/examples/alicloud-slb-vpc/outputs.tf b/examples/alicloud-slb-vpc/outputs.tf deleted file mode 100644 index d8e1cc93e8..0000000000 --- a/examples/alicloud-slb-vpc/outputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "slb_id" { - value = "${alicloud_slb.instance.id}" -} - -output "slbname" { - value = "${alicloud_slb.instance.name}" -} \ No newline at end of file diff --git a/examples/alicloud-slb-vpc/variables.tf b/examples/alicloud-slb-vpc/variables.tf deleted file mode 100644 index 7e9f9d390e..0000000000 --- a/examples/alicloud-slb-vpc/variables.tf +++ /dev/null @@ -1,30 +0,0 @@ -variable "availability_zones" { - default = "cn-beijing-c" -} - -variable "name" { - default = "slb_alicloud" -} - -variable "cidr_blocks" { - type = "map" - default = { - az0 = "10.1.1.0/24" - az1 = "10.1.2.0/24" - az2 = "10.1.3.0/24" - } -} - -variable "internet_charge_type" { - default = "paybytraffic" -} - -variable "long_name" { - default = "alicloud" -} -variable "vpc_cidr" { - default = "10.1.0.0/21" -} -variable "region" { - default = "cn-beijing" -} \ No newline at end of file diff --git a/examples/alicloud-slb/README.md b/examples/alicloud-slb/README.md deleted file mode 100644 index 50289d1d63..0000000000 --- a/examples/alicloud-slb/README.md +++ /dev/null @@ -1,43 +0,0 @@ -### SLB Example - -The example create SLB and additional listener, the listener parameter following: - -### SLB Listener parameter describe -listener parameter | support protocol | value range | remark | -------------- | ------------- | ------------- | ------------- | -instance_port | http & https & tcp & udp | 1-65535 | the ecs instance port | -lb_port | http & https & tcp & udp | 1-65535 | the slb linstener port | -lb_protocol | http & https & tcp & udp | http or https or tcp or udp | | -bandwidth | http & https & tcp & udp | -1 / 1-1000 | | -scheduler | http & https & tcp & udp | wrr or wlc | | -sticky_session | http & https | on or off | | -sticky_session_type | http & https | insert or server | if sticky_session is on, the value must have| -cookie_timeout | http & https | 1-86400 | if sticky_session is on and sticky_session_type is insert, the value must have| -cookie | http & https | | if sticky_session is on and sticky_session_type is server, the value must have| -persistence_timeout | tcp & udp | 0-3600 | | -health_check | http & https | on or off | | -health_check_type | tcp | tcp or http | if health_check is on, the value must have | -health_check_domain | http & https & tcp | | example: $_ip/some string/.if health_check is on, the value must have | -health_check_uri | http & https & tcp | | example: /aliyun. if health_check is on, the value must have | -health_check_connect_port | http & https & tcp & udp | 1-65535 or -520 | if health_check is on, the value must have | -healthy_threshold | http & https & tcp & udp | 1-10 | if health_check is on, the value must have | -unhealthy_threshold | http & https & tcp & udp | 1-10 | if health_check is on, the value must have | -health_check_timeout | http & https & tcp & udp | 1-50 | if health_check is on, the value must have | -health_check_interval | http & https & tcp & udp | 1-5 | if health_check is on, the value must have | -health_check_http_code | http & https & tcp | http_2xx,http_3xx,http_4xx,http_5xx | if health_check is on, the value must have | -ssl_certificate_id | https | | | - -### Get up and running - -* Planning phase - - terraform plan - -* Apply phase - - terraform apply - - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-slb/main.tf b/examples/alicloud-slb/main.tf deleted file mode 100644 index a4c179f69e..0000000000 --- a/examples/alicloud-slb/main.tf +++ /dev/null @@ -1,54 +0,0 @@ -resource "alicloud_slb" "instance" { - name = "${var.slb_name}" - internet_charge_type = "${var.internet_charge_type}" - internet = "${var.internet}" - - listener = [ - { - "instance_port" = "22" - "lb_port" = "22" - "lb_protocol" = "tcp" - "bandwidth" = "10" - "health_check_type" = "http" - "persistence_timeout" = 3600 - "healthy_threshold" = 8 - "unhealthy_threshold" = 8 - "health_check_timeout" = 8 - "health_check_interval" = 5 - "health_check_http_code" = "http_2xx,http_3xx" - "health_check_timeout" = 8 - }, - - { - "instance_port" = "2001" - "lb_port" = "2001" - "lb_protocol" = "udp" - "bandwidth" = "10" - "persistence_timeout" = 3600 - "healthy_threshold" = 8 - "unhealthy_threshold" = 8 - "health_check_timeout" = 8 - "health_check_interval" = 4 - "health_check_timeout" = 8 - }, - - { - "instance_port" = "80" - "lb_port" = "80" - "lb_protocol" = "http" - "sticky_session" = "on" - "sticky_session_type" = "server" - "cookie" = "testslblistenercookie" - "cookie_timeout" = 86400 - "health_check" = "on" - "health_check_domain" = "$_ip" - "health_check_uri" = "/console" - "health_check_connect_port" = 20 - "healthy_threshold" = 8 - "unhealthy_threshold" = 8 - "health_check_timeout" = 8 - "health_check_interval" = 5 - "health_check_http_code" = "http_2xx,http_3xx" - "bandwidth" = 10 - }] -} diff --git a/examples/alicloud-slb/outputs.tf b/examples/alicloud-slb/outputs.tf deleted file mode 100644 index d8e1cc93e8..0000000000 --- a/examples/alicloud-slb/outputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "slb_id" { - value = "${alicloud_slb.instance.id}" -} - -output "slbname" { - value = "${alicloud_slb.instance.name}" -} \ No newline at end of file diff --git a/examples/alicloud-slb/variables.tf b/examples/alicloud-slb/variables.tf deleted file mode 100644 index 7a741b295c..0000000000 --- a/examples/alicloud-slb/variables.tf +++ /dev/null @@ -1,11 +0,0 @@ -variable "slb_name" { - default = "slb_worder" -} - -variable "internet_charge_type" { - default = "paybytraffic" -} - -variable "internet" { - default = true -} diff --git a/examples/alicloud-vpc-cluster-sg/README.md b/examples/alicloud-vpc-cluster-sg/README.md deleted file mode 100644 index 5ef00e5f63..0000000000 --- a/examples/alicloud-vpc-cluster-sg/README.md +++ /dev/null @@ -1,19 +0,0 @@ -### SecurityGroups With Vpc Example - -The example create SecurityGroups for specify VPC Clusters. - -### Get up and running - -* Planning phase - - terraform plan - - -* Apply phase - - terraform apply - - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-vpc-cluster-sg/main.tf b/examples/alicloud-vpc-cluster-sg/main.tf deleted file mode 100644 index 1e6575aeb9..0000000000 --- a/examples/alicloud-vpc-cluster-sg/main.tf +++ /dev/null @@ -1,23 +0,0 @@ -resource "alicloud_security_group" "default" { - name = "${var.short_name}-default" - description = "Default security group for VPC" - vpc_id = "${var.vpc_id}" -} - -resource "alicloud_security_group" "control" { - name = "${var.short_name}-control" - description = "Allow inboud traffic for control nodes" - vpc_id = "${var.vpc_id}" -} - -resource "alicloud_security_group" "edge" { - name = "${var.short_name}-edge" - description = "Allow inboud traffic for edge routing" - vpc_id = "${var.vpc_id}" -} - -resource "alicloud_security_group" "worker" { - name = "${var.short_name}-worker" - description = "Allow inboud traffic for worker nodes" - vpc_id = "${var.vpc_id}" -} diff --git a/examples/alicloud-vpc-cluster-sg/outputs.tf b/examples/alicloud-vpc-cluster-sg/outputs.tf deleted file mode 100644 index f2e6408069..0000000000 --- a/examples/alicloud-vpc-cluster-sg/outputs.tf +++ /dev/null @@ -1,15 +0,0 @@ -output "default_security_group" { - value = "${alicloud_security_group.default.id}" -} - -output "edge_security_group" { - value = "${alicloud_security_group.edge.id}" -} - -output "control_security_group" { - value = "${alicloud_security_group.control.id}" -} - -output "worker_security_group" { - value = "${alicloud_security_group.worker.id}" -} diff --git a/examples/alicloud-vpc-cluster-sg/variables.tf b/examples/alicloud-vpc-cluster-sg/variables.tf deleted file mode 100644 index e37d4e0d23..0000000000 --- a/examples/alicloud-vpc-cluster-sg/variables.tf +++ /dev/null @@ -1,4 +0,0 @@ -variable "short_name" { -} -variable "vpc_id" { -} diff --git a/examples/alicloud-vpc-multi-region/README.md b/examples/alicloud-vpc-multi-region/README.md deleted file mode 100644 index e45fe46661..0000000000 --- a/examples/alicloud-vpc-multi-region/README.md +++ /dev/null @@ -1,18 +0,0 @@ -### VPC Example - -The example will create VPC in multi region use "alias" characters. - -### Get up and running - -* Planning phase - - terraform plan - -* Apply phase - - terraform apply - - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-vpc-multi-region/main.tf b/examples/alicloud-vpc-multi-region/main.tf deleted file mode 100644 index a3f946cc45..0000000000 --- a/examples/alicloud-vpc-multi-region/main.tf +++ /dev/null @@ -1,21 +0,0 @@ -provider "alicloud" { - alias = "bj" - region = "${var.region1}" -} - -provider "alicloud" { - alias = "hz" - region = "${var.region2}" -} - -resource "alicloud_vpc" "work" { - provider = "alicloud.hz" - name = "${var.long_name}" - cidr_block = "${var.vpc_cidr}" -} - -resource "alicloud_vpc" "control" { - provider = "alicloud.bj" - name = "${var.long_name}" - cidr_block = "${var.vpc_cidr}" -} diff --git a/examples/alicloud-vpc-multi-region/outputs.tf b/examples/alicloud-vpc-multi-region/outputs.tf deleted file mode 100644 index d46e24927a..0000000000 --- a/examples/alicloud-vpc-multi-region/outputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "vpc_work_id" { - value = "${alicloud_vpc.work.id}" -} - -output "vpc_control_id" { - value = "${alicloud_vpc.control.id}" -} \ No newline at end of file diff --git a/examples/alicloud-vpc-multi-region/variables.tf b/examples/alicloud-vpc-multi-region/variables.tf deleted file mode 100644 index c896ae47a0..0000000000 --- a/examples/alicloud-vpc-multi-region/variables.tf +++ /dev/null @@ -1,12 +0,0 @@ -variable "long_name" { - default = "alicloud" -} -variable "vpc_cidr" { - default = "10.1.0.0/21" -} -variable "region1" { - default = "cn-beijing" -} -variable "region2" { - default = "cn-hangzhou" -} \ No newline at end of file diff --git a/examples/alicloud-vpc-route-entry/main.tf b/examples/alicloud-vpc-route-entry/main.tf deleted file mode 100644 index 00540f88b5..0000000000 --- a/examples/alicloud-vpc-route-entry/main.tf +++ /dev/null @@ -1,77 +0,0 @@ -resource "alicloud_vpc" "default" { - name = "tf_vpc" - cidr_block = "${var.vpc_cidr}" -} - -resource "alicloud_vswitch" "default" { - vpc_id = "${alicloud_vpc.default.id}" - cidr_block = "${var.vswitch_cidr}" - availability_zone = "${var.zone_id}" -} - -resource "alicloud_route_entry" "default" { - router_id = "${alicloud_vpc.default.router_id}" - route_table_id = "${alicloud_vpc.default.router_table_id}" - destination_cidrblock = "${var.entry_cidr}" - nexthop_type = "Instance" - nexthop_id = "${alicloud_instance.snat.id}" -} - -resource "alicloud_security_group" "sg" { - name = "tf_sg" - description = "tf_sg" - vpc_id = "${alicloud_vpc.default.id}" -} - -resource "alicloud_security_group_rule" "ssh-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "intranet" - policy = "${var.rule_policy}" - port_range = "22/22" - priority = 1 - security_group_id = "${alicloud_security_group.sg.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_security_group_rule" "http-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "80/80" - priority = 1 - security_group_id = "${alicloud_security_group.sg.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_security_group_rule" "https-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "internet" - policy = "accept" - port_range = "443/443" - priority = 1 - security_group_id = "${alicloud_security_group.sg.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_instance" "snat" { - # cn-beijing - availability_zone = "${var.zone_id}" - security_groups = ["${alicloud_security_group.sg.id}"] - - vswitch_id = "${alicloud_vswitch.default.id}" - allocate_public_ip = true - - # series II - instance_charge_type = "PostPaid" - instance_type = "${var.instance_type}" - internet_charge_type = "${var.internet_charge_type}" - internet_max_bandwidth_out = 5 - io_optimized = "${var.io_optimized}" - - system_disk_category = "cloud_efficiency" - image_id = "${var.image_id}" - instance_name = "tf_snat" -} \ No newline at end of file diff --git a/examples/alicloud-vpc-route-entry/ouputs.tf b/examples/alicloud-vpc-route-entry/ouputs.tf deleted file mode 100644 index 37e60e250c..0000000000 --- a/examples/alicloud-vpc-route-entry/ouputs.tf +++ /dev/null @@ -1,15 +0,0 @@ -output "route_table_id" { - value = "${alicloud_route_entry.default.route_table_id}" -} - -output "router_id" { - value = "${alicloud_route_entry.default.router_id}" -} - -output "nexthop_type" { - value = "${alicloud_route_entry.default.nexthop_type}" -} - -output "nexthop_id" { - value = "${alicloud_route_entry.default.nexthop_id}" -} \ No newline at end of file diff --git a/examples/alicloud-vpc-route-entry/variables.tf b/examples/alicloud-vpc-route-entry/variables.tf deleted file mode 100644 index 4708e266f5..0000000000 --- a/examples/alicloud-vpc-route-entry/variables.tf +++ /dev/null @@ -1,28 +0,0 @@ - -variable "vpc_cidr" { - default = "10.1.0.0/21" -} -variable "vswitch_cidr" { - default = "10.1.1.0/24" -} -variable "zone_id" { - default = "cn-beijing-c" -} -variable "entry_cidr" { - default = "172.11.1.1/32" -} -variable "rule_policy" { - default = "accept" -} -variable "instance_type" { - default = "ecs.n1.small" -} -variable "image_id" { - default = "ubuntu_140405_64_40G_cloudinit_20161115.vhd" -} -variable "internet_charge_type" { - default = "PayByTraffic" -} -variable "io_optimized" { - default = "optimized" -} \ No newline at end of file diff --git a/examples/alicloud-vpc-snat/main.tf b/examples/alicloud-vpc-snat/main.tf deleted file mode 100644 index 1f204432ad..0000000000 --- a/examples/alicloud-vpc-snat/main.tf +++ /dev/null @@ -1,87 +0,0 @@ -provider "alicloud" { - region = "cn-hangzhou" -} - -data "alicloud_instance_types" "1c2g" { - cpu_core_count = 1 - memory_size = 2 - instance_type_family = "ecs.n1" -} - -data "alicloud_zones" "default" { - "available_instance_type"= "${data.alicloud_instance_types.1c2g.instance_types.0.id}" - "available_disk_category"= "${var.disk_category}" -} - -resource "alicloud_vpc" "default" { - name = "tf_vpc" - cidr_block = "${var.vpc_cidr}" -} - -resource "alicloud_vswitch" "default" { - vpc_id = "${alicloud_vpc.default.id}" - cidr_block = "${var.vswitch_cidr}" - availability_zone = "${data.alicloud_zones.default.zones.0.id}" -} - -resource "alicloud_nat_gateway" "default" { - vpc_id = "${alicloud_vpc.default.id}" - spec = "Small" - name = "test_foo" - bandwidth_packages = [{ - ip_count = 2 - bandwidth = 5 - zone = "${data.alicloud_zones.default.zones.0.id}" - }] - depends_on = [ - "alicloud_vswitch.default"] -} -resource "alicloud_snat_entry" "default"{ - snat_table_id = "${alicloud_nat_gateway.default.snat_table_ids}" - source_vswitch_id = "${alicloud_vswitch.default.id}" - snat_ip = "${element(split(",", alicloud_nat_gateway.default.bandwidth_packages.0.public_ip_addresses),0)}" -} - -resource "alicloud_forward_entry" "default"{ - forward_table_id = "${alicloud_nat_gateway.default.forward_table_ids}" - external_ip = "${element(split(",", alicloud_nat_gateway.default.bandwidth_packages.0.public_ip_addresses),1)}" - external_port = "80" - ip_protocol = "tcp" - internal_ip = "${alicloud_instance.default.private_ip}" - internal_port = "8080" -} - -resource "alicloud_security_group" "sg" { - name = "tf_sg" - description = "tf_sg" - vpc_id = "${alicloud_vpc.default.id}" -} - -resource "alicloud_security_group_rule" "http-in" { - type = "ingress" - ip_protocol = "tcp" - nic_type = "intranet" - policy = "accept" - port_range = "80/80" - priority = 1 - security_group_id = "${alicloud_security_group.sg.id}" - cidr_ip = "0.0.0.0/0" -} - -resource "alicloud_instance" "default" { - # cn-beijing - availability_zone = "${data.alicloud_zones.default.zones.0.id}" - security_groups = ["${alicloud_security_group.sg.id}"] - - vswitch_id = "${alicloud_vswitch.default.id}" - - # series II - instance_charge_type = "PostPaid" - instance_type = "${var.instance_type}" - internet_max_bandwidth_out = 0 - io_optimized = "${var.io_optimized}" - - system_disk_category = "cloud_efficiency" - image_id = "${var.image_id}" - instance_name = "tf_vpc_snat" -} \ No newline at end of file diff --git a/examples/alicloud-vpc-snat/ouputs.tf b/examples/alicloud-vpc-snat/ouputs.tf deleted file mode 100644 index f9a55914f3..0000000000 --- a/examples/alicloud-vpc-snat/ouputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "instance_id" { - value = "${alicloud_instance.default.id}" -} - -output "bindwidth_package_ip" { - value = "${alicloud_nat_gateway.default.bandwidth_packages.0.public_ip_addresses}" -} diff --git a/examples/alicloud-vpc-snat/variables.tf b/examples/alicloud-vpc-snat/variables.tf deleted file mode 100644 index 9e9eb76dbc..0000000000 --- a/examples/alicloud-vpc-snat/variables.tf +++ /dev/null @@ -1,22 +0,0 @@ - -variable "vpc_cidr" { - default = "10.1.0.0/21" -} -variable "vswitch_cidr" { - default = "10.1.1.0/24" -} -variable "rule_policy" { - default = "accept" -} -variable "instance_type" { - default = "ecs.n1.small" -} -variable "image_id" { - default = "ubuntu_140405_64_40G_cloudinit_20161115.vhd" -} -variable "io_optimized" { - default = "optimized" -} -variable "disk_category"{ - default = "cloud_efficiency" -} \ No newline at end of file diff --git a/examples/alicloud-vpc/README.md b/examples/alicloud-vpc/README.md deleted file mode 100644 index 392e0abc8d..0000000000 --- a/examples/alicloud-vpc/README.md +++ /dev/null @@ -1,18 +0,0 @@ -### VPC Example - -The example create VPC, VSwitch, Natgateway. The variables.tf can let you create specify parameter instances, such as availability_zone, cidr_block etc. - -### Get up and running - -* Planning phase - - terraform plan - -* Apply phase - - terraform apply - - -* Destroy - - terraform destroy \ No newline at end of file diff --git a/examples/alicloud-vpc/main.tf b/examples/alicloud-vpc/main.tf deleted file mode 100644 index 78d58b17cc..0000000000 --- a/examples/alicloud-vpc/main.tf +++ /dev/null @@ -1,28 +0,0 @@ -resource "alicloud_vpc" "main" { - name = "${var.long_name}" - cidr_block = "${var.vpc_cidr}" -} - -resource "alicloud_vswitch" "main" { - vpc_id = "${alicloud_vpc.main.id}" - count = "${length(split(",", var.availability_zones))}" - cidr_block = "${lookup(var.cidr_blocks, "az${count.index}")}" - availability_zone = "${var.availability_zones}" - depends_on = [ - "alicloud_vpc.main"] -} - -resource "alicloud_nat_gateway" "main" { - vpc_id = "${alicloud_vpc.main.id}" - spec = "Small" - bandwidth_packages = [ - { - ip_count = 1 - bandwidth = 5 - zone = "${var.availability_zones}" - } - ] - depends_on = [ - "alicloud_vswitch.main"] -} - diff --git a/examples/alicloud-vpc/outputs.tf b/examples/alicloud-vpc/outputs.tf deleted file mode 100644 index 06809a16a8..0000000000 --- a/examples/alicloud-vpc/outputs.tf +++ /dev/null @@ -1,11 +0,0 @@ -output "vpc_id" { - value = "${alicloud_vpc.main.id}" -} - -output "vswitch_ids" { - value = "${join(",", alicloud_vswitch.main.*.id)}" -} - -output "availability_zones" { - value = "${join(",",alicloud_vswitch.main.*.availability_zone)}" -} diff --git a/examples/alicloud-vpc/variables.tf b/examples/alicloud-vpc/variables.tf deleted file mode 100644 index 2b30cde057..0000000000 --- a/examples/alicloud-vpc/variables.tf +++ /dev/null @@ -1,25 +0,0 @@ -variable "availability_zones" { - default = "cn-beijing-c" -} - -variable "cidr_blocks" { - type = "map" - default = { - az0 = "10.1.1.0/24" - az1 = "10.1.2.0/24" - az2 = "10.1.3.0/24" - } -} - -variable "long_name" { - default = "alicloud" -} -variable "short_name" { - default = "ali" -} -variable "vpc_cidr" { - default = "10.1.0.0/21" -} -variable "region" { - default = "cn-beijing" -} \ No newline at end of file diff --git a/examples/aws-asg/README.md b/examples/aws-asg/README.md deleted file mode 100644 index d6b8140851..0000000000 --- a/examples/aws-asg/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# ASG example - -This example shows how to launch instances using Auto Scaling Groups. - -This creates a security group, launch configuration, auto scaling group and an ELB. The user data for launch configuration installs nginx and it listens on port 80. - -The example uses latest Ubuntu AMIs. - -Make sure you change the list of availability zones that is applicable to your account and region. - -To run, configure your AWS provider as described in https://www.terraform.io/docs/providers/aws/index.html - -Running the example - -For planning phase - -``` -terraform plan -var 'key_name={your_key_name}' -``` - -For apply phase - -``` -terraform apply -var 'key_name={your_key_name}' -``` -Once the stack is created, wait for few minutes and test the stack by launching a browser with ELB url. - -To remove the stack - -``` - terraform destroy -var 'key_name={your_key_name}' -``` diff --git a/examples/aws-asg/main.tf b/examples/aws-asg/main.tf deleted file mode 100644 index b70e89584d..0000000000 --- a/examples/aws-asg/main.tf +++ /dev/null @@ -1,86 +0,0 @@ -# Specify the provider and access details -provider "aws" { - region = "${var.aws_region}" -} - -resource "aws_elb" "web-elb" { - name = "terraform-example-elb" - - # The same availability zone as our instances - availability_zones = ["${split(",", var.availability_zones)}"] - - listener { - instance_port = 80 - instance_protocol = "http" - lb_port = 80 - lb_protocol = "http" - } - - health_check { - healthy_threshold = 2 - unhealthy_threshold = 2 - timeout = 3 - target = "HTTP:80/" - interval = 30 - } -} - -resource "aws_autoscaling_group" "web-asg" { - availability_zones = ["${split(",", var.availability_zones)}"] - name = "terraform-example-asg" - max_size = "${var.asg_max}" - min_size = "${var.asg_min}" - desired_capacity = "${var.asg_desired}" - force_delete = true - launch_configuration = "${aws_launch_configuration.web-lc.name}" - load_balancers = ["${aws_elb.web-elb.name}"] - - #vpc_zone_identifier = ["${split(",", var.availability_zones)}"] - tag { - key = "Name" - value = "web-asg" - propagate_at_launch = "true" - } -} - -resource "aws_launch_configuration" "web-lc" { - name = "terraform-example-lc" - image_id = "${lookup(var.aws_amis, var.aws_region)}" - instance_type = "${var.instance_type}" - - # Security group - security_groups = ["${aws_security_group.default.id}"] - user_data = "${file("userdata.sh")}" - key_name = "${var.key_name}" -} - -# Our default security group to access -# the instances over SSH and HTTP -resource "aws_security_group" "default" { - name = "terraform_example_sg" - description = "Used in the terraform" - - # SSH access from anywhere - ingress { - from_port = 22 - to_port = 22 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - # HTTP access from anywhere - ingress { - from_port = 80 - to_port = 80 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - # outbound internet access - egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - } -} diff --git a/examples/aws-asg/outputs.tf b/examples/aws-asg/outputs.tf deleted file mode 100644 index faa5864c5d..0000000000 --- a/examples/aws-asg/outputs.tf +++ /dev/null @@ -1,15 +0,0 @@ -output "security_group" { - value = "${aws_security_group.default.id}" -} - -output "launch_configuration" { - value = "${aws_launch_configuration.web-lc.id}" -} - -output "asg_name" { - value = "${aws_autoscaling_group.web-asg.id}" -} - -output "elb_name" { - value = "${aws_elb.web-elb.dns_name}" -} diff --git a/examples/aws-asg/userdata.sh b/examples/aws-asg/userdata.sh deleted file mode 100644 index 77e340b3ab..0000000000 --- a/examples/aws-asg/userdata.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -v -apt-get update -y -apt-get install -y nginx > /tmp/nginx.log diff --git a/examples/aws-asg/variables.tf b/examples/aws-asg/variables.tf deleted file mode 100644 index d45c10d252..0000000000 --- a/examples/aws-asg/variables.tf +++ /dev/null @@ -1,41 +0,0 @@ -variable "aws_region" { - description = "The AWS region to create things in." - default = "us-east-1" -} - -# ubuntu-trusty-14.04 (x64) -variable "aws_amis" { - default = { - "us-east-1" = "ami-5f709f34" - "us-west-2" = "ami-7f675e4f" - } -} - -variable "availability_zones" { - default = "us-east-1b,us-east-1c,us-east-1d,us-east-1e" - description = "List of availability zones, use AWS CLI to find your " -} - -variable "key_name" { - description = "Name of AWS key pair" -} - -variable "instance_type" { - default = "t2.micro" - description = "AWS instance type" -} - -variable "asg_min" { - description = "Min numbers of servers in ASG" - default = "1" -} - -variable "asg_max" { - description = "Max numbers of servers in ASG" - default = "2" -} - -variable "asg_desired" { - description = "Desired numbers of servers in ASG" - default = "1" -} diff --git a/examples/aws-cloudwatch-events/kinesis/README.md b/examples/aws-cloudwatch-events/kinesis/README.md deleted file mode 100644 index 2dcb829cc0..0000000000 --- a/examples/aws-cloudwatch-events/kinesis/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# CloudWatch Event sent to Kinesis Stream - -This example sets up a CloudWatch Event Rule with a Target and IAM Role & Policy -to send all autoscaling events into Kinesis stream for further examination. - -See more details about [CloudWatch Events](http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/WhatIsCloudWatchEvents.html) -in the official AWS docs. - -## How to run the example - -``` -terraform apply \ - -var=aws_region=us-west-2 -``` diff --git a/examples/aws-cloudwatch-events/kinesis/main.tf b/examples/aws-cloudwatch-events/kinesis/main.tf deleted file mode 100644 index db8555020e..0000000000 --- a/examples/aws-cloudwatch-events/kinesis/main.tf +++ /dev/null @@ -1,76 +0,0 @@ -provider "aws" { - region = "${var.aws_region}" -} - -resource "aws_cloudwatch_event_rule" "foo" { - name = "${var.rule_name}" - - event_pattern = < /tmp/nginx.log - diff --git a/examples/aws-eip/variables.tf b/examples/aws-eip/variables.tf deleted file mode 100644 index 400301d5fc..0000000000 --- a/examples/aws-eip/variables.tf +++ /dev/null @@ -1,16 +0,0 @@ -variable "aws_region" { - description = "The AWS region to create things in." - default = "us-east-1" -} - -# ubuntu-trusty-14.04 (x64) -variable "aws_amis" { - default = { - "us-east-1" = "ami-5f709f34" - "us-west-2" = "ami-7f675e4f" - } -} - -variable "key_name" { - description = "Name of the SSH keypair to use in AWS." -} diff --git a/examples/aws-elb/README.md b/examples/aws-elb/README.md deleted file mode 100644 index 0c31b4fdbf..0000000000 --- a/examples/aws-elb/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# ELB with stickiness Example - -The example launches a web server, installs nginx, creates an ELB for instance. It also creates security groups for the ELB and EC2 instance. - -To run, configure your AWS provider as described in https://www.terraform.io/docs/providers/aws/index.html - -This example assumes you have created a Key Pair. Visit -https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#KeyPairs:sort=keyName -to create a key if you do not have one. - -Run this example using: - - terraform apply -var 'key_name=YOUR_KEY_NAME' - -Wait a couple of minutes for the EC2 userdata to install nginx, and then type the ELB DNS Name from outputs in your browser and see the nginx welcome page diff --git a/examples/aws-elb/main.tf b/examples/aws-elb/main.tf deleted file mode 100644 index b7f131f245..0000000000 --- a/examples/aws-elb/main.tf +++ /dev/null @@ -1,174 +0,0 @@ -# Specify the provider and access details -provider "aws" { - region = "${var.aws_region}" -} - -resource "aws_vpc" "default" { - cidr_block = "10.0.0.0/16" - enable_dns_hostnames = true - - tags { - Name = "tf_test" - } -} - -resource "aws_subnet" "tf_test_subnet" { - vpc_id = "${aws_vpc.default.id}" - cidr_block = "10.0.0.0/24" - map_public_ip_on_launch = true - - tags { - Name = "tf_test_subnet" - } -} - -resource "aws_internet_gateway" "gw" { - vpc_id = "${aws_vpc.default.id}" - - tags { - Name = "tf_test_ig" - } -} - -resource "aws_route_table" "r" { - vpc_id = "${aws_vpc.default.id}" - - route { - cidr_block = "0.0.0.0/0" - gateway_id = "${aws_internet_gateway.gw.id}" - } - - tags { - Name = "aws_route_table" - } -} - -resource "aws_route_table_association" "a" { - subnet_id = "${aws_subnet.tf_test_subnet.id}" - route_table_id = "${aws_route_table.r.id}" -} - -# Our default security group to access -# the instances over SSH and HTTP -resource "aws_security_group" "default" { - name = "instance_sg" - description = "Used in the terraform" - vpc_id = "${aws_vpc.default.id}" - - # SSH access from anywhere - ingress { - from_port = 22 - to_port = 22 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - # HTTP access from anywhere - ingress { - from_port = 80 - to_port = 80 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - # outbound internet access - egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - } -} - -# Our elb security group to access -# the ELB over HTTP -resource "aws_security_group" "elb" { - name = "elb_sg" - description = "Used in the terraform" - - vpc_id = "${aws_vpc.default.id}" - - # HTTP access from anywhere - ingress { - from_port = 80 - to_port = 80 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - # outbound internet access - egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - } - - # ensure the VPC has an Internet gateway or this step will fail - depends_on = ["aws_internet_gateway.gw"] -} - -resource "aws_elb" "web" { - name = "example-elb" - - # The same availability zone as our instance - subnets = ["${aws_subnet.tf_test_subnet.id}"] - - security_groups = ["${aws_security_group.elb.id}"] - - listener { - instance_port = 80 - instance_protocol = "http" - lb_port = 80 - lb_protocol = "http" - } - - health_check { - healthy_threshold = 2 - unhealthy_threshold = 2 - timeout = 3 - target = "HTTP:80/" - interval = 30 - } - - # The instance is registered automatically - - instances = ["${aws_instance.web.id}"] - cross_zone_load_balancing = true - idle_timeout = 400 - connection_draining = true - connection_draining_timeout = 400 -} - -resource "aws_lb_cookie_stickiness_policy" "default" { - name = "lbpolicy" - load_balancer = "${aws_elb.web.id}" - lb_port = 80 - cookie_expiration_period = 600 -} - -resource "aws_instance" "web" { - instance_type = "t2.micro" - - # Lookup the correct AMI based on the region - # we specified - ami = "${lookup(var.aws_amis, var.aws_region)}" - - # The name of our SSH keypair you've created and downloaded - # from the AWS console. - # - # https://console.aws.amazon.com/ec2/v2/home?region=us-west-2#KeyPairs: - # - key_name = "${var.key_name}" - - # Our Security group to allow HTTP and SSH access - vpc_security_group_ids = ["${aws_security_group.default.id}"] - subnet_id = "${aws_subnet.tf_test_subnet.id}" - user_data = "${file("userdata.sh")}" - - #Instance tags - - tags { - Name = "elb-example" - } -} diff --git a/examples/aws-elb/outputs.tf b/examples/aws-elb/outputs.tf deleted file mode 100644 index 5977837f33..0000000000 --- a/examples/aws-elb/outputs.tf +++ /dev/null @@ -1,3 +0,0 @@ -output "address" { - value = "${aws_elb.web.dns_name}" -} diff --git a/examples/aws-elb/userdata.sh b/examples/aws-elb/userdata.sh deleted file mode 100644 index 8a058c7861..0000000000 --- a/examples/aws-elb/userdata.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -v -apt-get update -y -apt-get install -y nginx > /tmp/nginx.log - diff --git a/examples/aws-elb/variables.tf b/examples/aws-elb/variables.tf deleted file mode 100644 index 2f9175fc84..0000000000 --- a/examples/aws-elb/variables.tf +++ /dev/null @@ -1,16 +0,0 @@ -variable "key_name" { - description = "Name of the SSH keypair to use in AWS." -} - -variable "aws_region" { - description = "AWS region to launch servers." - default = "us-east-1" -} - -# ubuntu-trusty-14.04 (x64) -variable "aws_amis" { - default = { - "us-east-1" = "ami-5f709f34" - "us-west-2" = "ami-7f675e4f" - } -} diff --git a/examples/aws-networking/.gitignore b/examples/aws-networking/.gitignore deleted file mode 100644 index 6382ccad7c..0000000000 --- a/examples/aws-networking/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -terraform.tfstate -terraform.tfstate.backup -.terraform/* diff --git a/examples/aws-networking/README.md b/examples/aws-networking/README.md deleted file mode 100644 index f684e7c9b9..0000000000 --- a/examples/aws-networking/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# AWS Networking Example - -This example creates AWS VPC resources, making a VPC in each of two regions and -then two subnets in each VPC in two different availability zones. - -This example also demonstrates the use of modules to create several copies of -the same resource set with different arguments. The child modules in this -directory are: - -* `region`: container module for all of the network resources within a region. This is instantiated once per region. -* `subnet`: represents a subnet within a given availability zone. This is instantiated twice per region, using the first two availability zones supported within the target AWS account. diff --git a/examples/aws-networking/numbering/variables.tf b/examples/aws-networking/numbering/variables.tf deleted file mode 100644 index ae32caa89a..0000000000 --- a/examples/aws-networking/numbering/variables.tf +++ /dev/null @@ -1,27 +0,0 @@ -variable "region_numbers" { - default = { - us-east-1 = 1 - us-west-1 = 2 - us-west-2 = 3 - eu-west-1 = 4 - } -} - -variable "az_numbers" { - default = { - a = 1 - b = 2 - c = 3 - d = 4 - e = 5 - f = 6 - g = 7 - h = 8 - i = 9 - j = 10 - k = 11 - l = 12 - m = 13 - n = 14 - } -} diff --git a/examples/aws-networking/region/numbering.tf b/examples/aws-networking/region/numbering.tf deleted file mode 120000 index 49f7617b05..0000000000 --- a/examples/aws-networking/region/numbering.tf +++ /dev/null @@ -1 +0,0 @@ -../numbering/variables.tf \ No newline at end of file diff --git a/examples/aws-networking/region/outputs.tf b/examples/aws-networking/region/outputs.tf deleted file mode 100644 index fd2c64c3e9..0000000000 --- a/examples/aws-networking/region/outputs.tf +++ /dev/null @@ -1,11 +0,0 @@ -output "vpc_id" { - value = "${aws_vpc.main.id}" -} - -output "primary_subnet_id" { - value = "${module.primary_subnet.subnet_id}" -} - -output "secondary_subnet_id" { - value = "${module.secondary_subnet.subnet_id}" -} diff --git a/examples/aws-networking/region/security_group.tf b/examples/aws-networking/region/security_group.tf deleted file mode 100644 index c5792dca55..0000000000 --- a/examples/aws-networking/region/security_group.tf +++ /dev/null @@ -1,25 +0,0 @@ -resource "aws_security_group" "region" { - name = "region" - description = "Open access within this region" - vpc_id = "${aws_vpc.main.id}" - - ingress { - from_port = 0 - to_port = 0 - protocol = -1 - cidr_blocks = ["${aws_vpc.main.cidr_block}"] - } -} - -resource "aws_security_group" "internal-all" { - name = "internal-all" - description = "Open access within the full internal network" - vpc_id = "${aws_vpc.main.id}" - - ingress { - from_port = 0 - to_port = 0 - protocol = -1 - cidr_blocks = ["${var.base_cidr_block}"] - } -} diff --git a/examples/aws-networking/region/subnets.tf b/examples/aws-networking/region/subnets.tf deleted file mode 100644 index d51b107111..0000000000 --- a/examples/aws-networking/region/subnets.tf +++ /dev/null @@ -1,14 +0,0 @@ -data "aws_availability_zones" "all" { -} - -module "primary_subnet" { - source = "../subnet" - vpc_id = "${aws_vpc.main.id}" - availability_zone = "${data.aws_availability_zones.all.names[0]}" -} - -module "secondary_subnet" { - source = "../subnet" - vpc_id = "${aws_vpc.main.id}" - availability_zone = "${data.aws_availability_zones.all.names[1]}" -} diff --git a/examples/aws-networking/region/variables.tf b/examples/aws-networking/region/variables.tf deleted file mode 100644 index b5916f051c..0000000000 --- a/examples/aws-networking/region/variables.tf +++ /dev/null @@ -1,9 +0,0 @@ -variable "region" { - description = "The name of the AWS region to set up a network within" -} - -variable "base_cidr_block" {} - -provider "aws" { - region = "${var.region}" -} diff --git a/examples/aws-networking/region/vpc.tf b/examples/aws-networking/region/vpc.tf deleted file mode 100644 index 84a5e91148..0000000000 --- a/examples/aws-networking/region/vpc.tf +++ /dev/null @@ -1,7 +0,0 @@ -resource "aws_vpc" "main" { - cidr_block = "${cidrsubnet(var.base_cidr_block, 4, lookup(var.region_numbers, var.region))}" -} - -resource "aws_internet_gateway" "main" { - vpc_id = "${aws_vpc.main.id}" -} diff --git a/examples/aws-networking/regions.tf b/examples/aws-networking/regions.tf deleted file mode 100644 index 2041bf7026..0000000000 --- a/examples/aws-networking/regions.tf +++ /dev/null @@ -1,11 +0,0 @@ -module "us-east-1" { - source = "./region" - region = "us-east-1" - base_cidr_block = "${var.base_cidr_block}" -} - -module "us-west-2" { - source = "./region" - region = "us-west-2" - base_cidr_block = "${var.base_cidr_block}" -} diff --git a/examples/aws-networking/subnet/numbering.tf b/examples/aws-networking/subnet/numbering.tf deleted file mode 120000 index 49f7617b05..0000000000 --- a/examples/aws-networking/subnet/numbering.tf +++ /dev/null @@ -1 +0,0 @@ -../numbering/variables.tf \ No newline at end of file diff --git a/examples/aws-networking/subnet/outputs.tf b/examples/aws-networking/subnet/outputs.tf deleted file mode 100644 index e7ef1921b0..0000000000 --- a/examples/aws-networking/subnet/outputs.tf +++ /dev/null @@ -1,3 +0,0 @@ -output "subnet_id" { - value = "${aws_subnet.main.id}" -} diff --git a/examples/aws-networking/subnet/security_group.tf b/examples/aws-networking/subnet/security_group.tf deleted file mode 100644 index 5761ab56fc..0000000000 --- a/examples/aws-networking/subnet/security_group.tf +++ /dev/null @@ -1,12 +0,0 @@ -resource "aws_security_group" "az" { - name = "az-${data.aws_availability_zone.target.name}" - description = "Open access within the AZ ${data.aws_availability_zone.target.name}" - vpc_id = "${var.vpc_id}" - - ingress { - from_port = 0 - to_port = 0 - protocol = -1 - cidr_blocks = ["${aws_subnet.main.cidr_block}"] - } -} diff --git a/examples/aws-networking/subnet/subnet.tf b/examples/aws-networking/subnet/subnet.tf deleted file mode 100644 index 74328d22fc..0000000000 --- a/examples/aws-networking/subnet/subnet.tf +++ /dev/null @@ -1,14 +0,0 @@ -resource "aws_subnet" "main" { - cidr_block = "${cidrsubnet(data.aws_vpc.target.cidr_block, 4, lookup(var.az_numbers, data.aws_availability_zone.target.name_suffix))}" - vpc_id = "${var.vpc_id}" - availability_zone = "${var.availability_zone}" -} - -resource "aws_route_table" "main" { - vpc_id = "${var.vpc_id}" -} - -resource "aws_route_table_association" "main" { - subnet_id = "${aws_subnet.main.id}" - route_table_id = "${aws_route_table.main.id}" -} diff --git a/examples/aws-networking/subnet/variables.tf b/examples/aws-networking/subnet/variables.tf deleted file mode 100644 index 6380852681..0000000000 --- a/examples/aws-networking/subnet/variables.tf +++ /dev/null @@ -1,11 +0,0 @@ -variable "vpc_id" {} - -variable "availability_zone" {} - -data "aws_availability_zone" "target" { - name = "${var.availability_zone}" -} - -data "aws_vpc" "target" { - id = "${var.vpc_id}" -} diff --git a/examples/aws-networking/variables.tf b/examples/aws-networking/variables.tf deleted file mode 100644 index 054a1fc09f..0000000000 --- a/examples/aws-networking/variables.tf +++ /dev/null @@ -1,3 +0,0 @@ -variable "base_cidr_block" { - default = "10.0.0.0/12" -} diff --git a/examples/aws-rds/README.md b/examples/aws-rds/README.md deleted file mode 100644 index df492e4d72..0000000000 --- a/examples/aws-rds/README.md +++ /dev/null @@ -1,18 +0,0 @@ -## Creating an RDS instance in AWS - -This example provides sample configuration for creating a mysql or postgres instance. For Oracle/SQL Servers, replace default values with appropriate values, they are not included in sample since the number of options are high. - -The example creates db subnet groups and a VPC security group as inputs to the instance creation - -For AWS provider, set up your AWS environment as outlined in https://www.terraform.io/docs/providers/aws/index.html - -If you need to use existing security groups and subnets, remove the `sg.tf` and `subnets.tf` files and replace the corresponding sections in `main.tf` under `aws_db_instance` - -Pass the password variable through your ENV variable. - -Several parameters are externalized, review the different variables.tf files and change them to fit your needs. Carefully review the CIDR blocks, egress/ingress rules, availability zones that are very specific to your account. - -Once ready run `terraform plan` to review. -At the minimum, provide the vpc_id as input variable. - -Once satisfied with plan, run `terraform apply` diff --git a/examples/aws-rds/main.tf b/examples/aws-rds/main.tf deleted file mode 100644 index cf935630d5..0000000000 --- a/examples/aws-rds/main.tf +++ /dev/null @@ -1,19 +0,0 @@ -resource "aws_db_instance" "default" { - depends_on = ["aws_security_group.default"] - identifier = "${var.identifier}" - allocated_storage = "${var.storage}" - engine = "${var.engine}" - engine_version = "${lookup(var.engine_version, var.engine)}" - instance_class = "${var.instance_class}" - name = "${var.db_name}" - username = "${var.username}" - password = "${var.password}" - vpc_security_group_ids = ["${aws_security_group.default.id}"] - db_subnet_group_name = "${aws_db_subnet_group.default.id}" -} - -resource "aws_db_subnet_group" "default" { - name = "main_subnet_group" - description = "Our main group of subnets" - subnet_ids = ["${aws_subnet.subnet_1.id}", "${aws_subnet.subnet_2.id}"] -} diff --git a/examples/aws-rds/outputs.tf b/examples/aws-rds/outputs.tf deleted file mode 100644 index ac931fb123..0000000000 --- a/examples/aws-rds/outputs.tf +++ /dev/null @@ -1,11 +0,0 @@ -output "subnet_group" { - value = "${aws_db_subnet_group.default.name}" -} - -output "db_instance_id" { - value = "${aws_db_instance.default.id}" -} - -output "db_instance_address" { - value = "${aws_db_instance.default.address}" -} diff --git a/examples/aws-rds/sg-variables.tf b/examples/aws-rds/sg-variables.tf deleted file mode 100644 index c6db98abb6..0000000000 --- a/examples/aws-rds/sg-variables.tf +++ /dev/null @@ -1,9 +0,0 @@ -variable "cidr_blocks" { - default = "0.0.0.0/0" - description = "CIDR for sg" -} - -variable "sg_name" { - default = "rds_sg" - description = "Tag Name for sg" -} diff --git a/examples/aws-rds/sg.tf b/examples/aws-rds/sg.tf deleted file mode 100644 index d6465a1930..0000000000 --- a/examples/aws-rds/sg.tf +++ /dev/null @@ -1,23 +0,0 @@ -resource "aws_security_group" "default" { - name = "main_rds_sg" - description = "Allow all inbound traffic" - vpc_id = "${var.vpc_id}" - - ingress { - from_port = 0 - to_port = 65535 - protocol = "TCP" - cidr_blocks = ["${var.cidr_blocks}"] - } - - egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - } - - tags { - Name = "${var.sg_name}" - } -} diff --git a/examples/aws-rds/subnet-variables.tf b/examples/aws-rds/subnet-variables.tf deleted file mode 100644 index cf9d9b731c..0000000000 --- a/examples/aws-rds/subnet-variables.tf +++ /dev/null @@ -1,23 +0,0 @@ -variable "subnet_1_cidr" { - default = "10.0.1.0/24" - description = "Your AZ" -} - -variable "subnet_2_cidr" { - default = "10.0.2.0/24" - description = "Your AZ" -} - -variable "az_1" { - default = "us-east-1b" - description = "Your Az1, use AWS CLI to find your account specific" -} - -variable "az_2" { - default = "us-east-1c" - description = "Your Az2, use AWS CLI to find your account specific" -} - -variable "vpc_id" { - description = "Your VPC ID" -} diff --git a/examples/aws-rds/subnets.tf b/examples/aws-rds/subnets.tf deleted file mode 100644 index 3af14b5881..0000000000 --- a/examples/aws-rds/subnets.tf +++ /dev/null @@ -1,19 +0,0 @@ -resource "aws_subnet" "subnet_1" { - vpc_id = "${var.vpc_id}" - cidr_block = "${var.subnet_1_cidr}" - availability_zone = "${var.az_1}" - - tags { - Name = "main_subnet1" - } -} - -resource "aws_subnet" "subnet_2" { - vpc_id = "${var.vpc_id}" - cidr_block = "${var.subnet_2_cidr}" - availability_zone = "${var.az_2}" - - tags { - Name = "main_subnet2" - } -} diff --git a/examples/aws-rds/variables.tf b/examples/aws-rds/variables.tf deleted file mode 100644 index 1c7ba5672d..0000000000 --- a/examples/aws-rds/variables.tf +++ /dev/null @@ -1,42 +0,0 @@ -variable "identifier" { - default = "mydb-rds" - description = "Identifier for your DB" -} - -variable "storage" { - default = "10" - description = "Storage size in GB" -} - -variable "engine" { - default = "postgres" - description = "Engine type, example values mysql, postgres" -} - -variable "engine_version" { - description = "Engine version" - - default = { - mysql = "5.6.22" - postgres = "9.4.1" - } -} - -variable "instance_class" { - default = "db.t2.micro" - description = "Instance class" -} - -variable "db_name" { - default = "mydb" - description = "db name" -} - -variable "username" { - default = "myuser" - description = "User name" -} - -variable "password" { - description = "password, provide through your ENV variables" -} diff --git a/examples/aws-s3-cross-account-access/README.md b/examples/aws-s3-cross-account-access/README.md deleted file mode 100644 index fa94aa3010..0000000000 --- a/examples/aws-s3-cross-account-access/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# S3 bucket with cross-account access - -This example describes how to create an S3 bucket in one AWS account and give access to that bucket to another user from another AWS account using bucket policy. -It demonstrates capabilities of provider aliases. - -See [more in the S3 documentation](http://docs.aws.amazon.com/AmazonS3/latest/dev/example-walkthroughs-managing-access-example2.html). - -## How to run - -Either `cp terraform.template.tfvars terraform.tfvars` and modify that new file accordingly or provide variables via CLI: - -``` -terraform apply \ - -var="prod_access_key=AAAAAAAAAAAAAAAAAAA" \ - -var="prod_secret_key=SuperSecretKeyForAccountA" \ - -var="test_account_id=123456789012" \ - -var="test_access_key=BBBBBBBBBBBBBBBBBBB" \ - -var="test_secret_key=SuperSecretKeyForAccountB" \ - -var="bucket_name=tf-bucket-in-prod" \ -``` diff --git a/examples/aws-s3-cross-account-access/main.tf b/examples/aws-s3-cross-account-access/main.tf deleted file mode 100644 index 72306e912d..0000000000 --- a/examples/aws-s3-cross-account-access/main.tf +++ /dev/null @@ -1,55 +0,0 @@ -provider "aws" { - alias = "prod" - - region = "us-east-1" - access_key = "${var.prod_access_key}" - secret_key = "${var.prod_secret_key}" -} - -resource "aws_s3_bucket" "prod" { - provider = "aws.prod" - - bucket = "${var.bucket_name}" - acl = "private" - - policy = <