terraform-provider-aws

ECS with Terraform

荒凉一梦 提交于 2020-07-23 06:20:07
问题 Is there a good / definitive reference or course for managing a ECS service using Terraform. I have referred this which creates the ECS Service, but I can't get to a state where my task runs on that cluster. Here is what I have for now: # create the VPC resource "aws_vpc" "vpc" { cidr_block = var.cidr_vpc instance_tenancy = var.instanceTenancy enable_dns_support = var.dnsSupport enable_dns_hostnames = var.dnsHostNames tags = { Name = "tdemo" } } # Create the Internet Gateway resource "aws

ECS with Terraform

岁酱吖の 提交于 2020-07-23 06:19:08
问题 Is there a good / definitive reference or course for managing a ECS service using Terraform. I have referred this which creates the ECS Service, but I can't get to a state where my task runs on that cluster. Here is what I have for now: # create the VPC resource "aws_vpc" "vpc" { cidr_block = var.cidr_vpc instance_tenancy = var.instanceTenancy enable_dns_support = var.dnsSupport enable_dns_hostnames = var.dnsHostNames tags = { Name = "tdemo" } } # Create the Internet Gateway resource "aws

ECS with Terraform

妖精的绣舞 提交于 2020-07-23 06:17:56
问题 Is there a good / definitive reference or course for managing a ECS service using Terraform. I have referred this which creates the ECS Service, but I can't get to a state where my task runs on that cluster. Here is what I have for now: # create the VPC resource "aws_vpc" "vpc" { cidr_block = var.cidr_vpc instance_tenancy = var.instanceTenancy enable_dns_support = var.dnsSupport enable_dns_hostnames = var.dnsHostNames tags = { Name = "tdemo" } } # Create the Internet Gateway resource "aws

Is there a way to confirm user_data ran successfully with Terraform for EC2?

喜夏-厌秋 提交于 2020-07-09 17:11:55
问题 I'm wondering if it's possible to know when the script in user data executes completely? data "template_file" "script" { template = file("${path.module}/installing.sh") } data "template_cloudinit_config" "config" { gzip = false base64_encode = false # Main cloud-config configuration file. part { filename = "install.sh" content = "${data.template_file.script.rendered}" } } resource "aws_instance" "web" { ami = "ami-04e7b4117bb0488e4" instance_type = "t2.micro" key_name = "KEY" vpc_security

Terraform: All security group rules are destroyed and replaced when adding a single rule

淺唱寂寞╮ 提交于 2020-07-09 14:40:59
问题 Terraform Info: Terraform v0.12.18 provider.aws v2.43.0 provider.template v2.1.2 I have a security group defined: If I run terraform plan or terraform apply against my existing stack, there are NO changes pending, state is fully up-to-date. resource "aws_security_group" "sg_apps" { name = "Custom apps ${var.env}" description = "Custom apps ${var.env}" vpc_id = data.terraform_remote_state.vpc.outputs.vpc_east_id tags = { Name = "Custom apps ${var.env} - TF" } ingress { from_port = 3306 to_port

Terraform: All security group rules are destroyed and replaced when adding a single rule

梦想的初衷 提交于 2020-07-09 14:39:35
问题 Terraform Info: Terraform v0.12.18 provider.aws v2.43.0 provider.template v2.1.2 I have a security group defined: If I run terraform plan or terraform apply against my existing stack, there are NO changes pending, state is fully up-to-date. resource "aws_security_group" "sg_apps" { name = "Custom apps ${var.env}" description = "Custom apps ${var.env}" vpc_id = data.terraform_remote_state.vpc.outputs.vpc_east_id tags = { Name = "Custom apps ${var.env} - TF" } ingress { from_port = 3306 to_port

Terraform EC2 networking broken

匆匆过客 提交于 2020-06-28 03:38:32
问题 I'm using Terraform 0.12.26 and I want to build an AWS Ubuntu machine instance. When I run terraform apply , everything looks right... but I can't ssh to the new EC2 machine. My home firewall allows ssh everywhere, and I can ssh to any other internet resources. If I manually install an EC2 instance in the same region / az, ssh works fine... this problem seems to be limited to Terraform. $ terraform apply ... Do you want to perform these actions? Terraform will perform the actions described

Terraform fails remote-exec (aws/ec2)

有些话、适合烂在心里 提交于 2020-06-27 09:20:32
问题 When trying to execute a shell script throw provisioner "remote-exec" in terraform connection not establish I'm using ami for ubuntu-xenial-16.04 so the user is ubuntu This is the last code that I use to execute the shell script: resource "aws_instance" "secondary_zone" { count = 1 instance_type = "${var.ec2_instance_type}" ami = "${data.aws_ami.latest-ubuntu.id}" key_name = "${aws_key_pair.deployer.key_name}" subnet_id = "${aws_subnet.secondary.id}" vpc_security_group_ids = ["${aws_security

Terraform import AWS Batch job definition from another project

偶尔善良 提交于 2020-06-17 09:41:44
问题 I have multiple projects, each with their own Terraform to manage the AWS infrastructure specific to that project. Infrastructure that's shared (a VPC for example): I import into the projects that need it. I want to glue together a number of different tasks from across different services using step functions, but some of them are Batch jobs. This means I need to specify the job definition ARN in the step function. I can import a job definition but if I later update the project that manages

terraform copy/upload files to aws ec2 instance

谁说胖子不能爱 提交于 2020-06-16 19:54:09
问题 We have cronjob and shell script which we want to copy or upload to aws ec2 instance while creating instance using terraform. we tried file provisioner : but its not wokring , and read this option does not work with all terraform version provisioner "file" { source = "abc.sh" destination = "/home/ec2-user/basic2.sh" } tried data template file option data "template_file" "userdata_line" { template = <<EOF #!/bin/bash mkdir /home/ec2-user/files2 cd /home/ec2-user/files2 sudo touch basic2.sh