resource "aws_cloudformation_stack" "network" {
name = "networking-stack"
parameters {
VPCCidr = "10.0.0.0/16"
}
template_body = <<STACK
{
"Description": "Template Version 1.0.0: AWS CloudFormation Template for creating a full stack with a 1NIC BIG-IP, a 1 Availability Zone VPC, subnets, security groups and a webserver (Bitnami LAMP stack with username bitnami **WARNING** This template creates Amazon EC2 Instances. You will be billed for the AWS resources used if you create a stack from this template.",
"Mappings": {
"BigipRegionMap": {
"ap-northeast-1": {
"Best1000Mbps": "ami-acf82acd",
"Best200Mbps": "ami-6bfc2e0a",
"Best25Mbps": "ami-a6f92bc7",
"Better1000Mbps": "ami-aff82ace",
-----snippet
},
"Type": "AWS::EC2::Subnet"
}
}
}
}
} STACK
}
ubuntu@ubuntu-xenial:~/terraform/sanbox$ terraform plan
Error loading config: Error loading /home/ubuntu/terraform/sanbox/main.tf: Error reading config for aws_cloudformation_stack[network]: parse error: syntax error
ubuntu@ubuntu-xenial:~/terraform/sanbox$
You might do better saving your preexisting template to a file and importing to your terraform stack like this
template_body = "${file("cft.json")}"
On Wednesday, March 15, 2017 at 3:33:57 PM UTC-4, Sanjay Shitole wrote:Folks,Was trying to run CFT from terraform getting error, any help is appreciated ... below is the snippet
1.0/24\",\"Tags\":[{\"Key\":\"Application\",\"Value\":{\"Ref\":\"application\"}},{\"Key\":\"Costcenter\",\"Value\":{\"Ref\":\"costcenter\"}},{\"Key\":\"Environment\",\"Value\":{\"Ref\":\"environment\"}},{\"Key\":\"Group\",\"Value\":{\"Ref\":\"group\"}},{\"Key\":\"Name\",\"Value\":{\"Fn::Join\":[\"\",[\"Az\",\"1\",\" External Subnet:\",{\"Ref\":\"AWS::StackName\"}]]}},{\"Key\":\"Owner\",\"Value\":{\"Ref\":\"owner\"}}],\"VpcId\":{\"Ref\":\"Vpc\"}},\"Type\":\"AWS::EC2::Subnet\"}}}"
Error applying plan:
1 error(s) occurred:
* aws_cloudformation_stack.network: Creating CloudFormation stack failed: ValidationError: Parameters: [availabilityZone1, sshKey, adminPassword] must have values
status code: 400, request id: 01999b65-14cb-11e7-a932-e73c151739d8
Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/5c15ff65-fecc-4ed6-8b67-ce5e04f2bc5c%40googlegroups.com.--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Terraform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/terraform-tool/3Hr3nxBKpM0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/CA%2BvtdQZkYr4D2XNd9MZrJwrv3K%2BqRDqoTE4A-_4fOjorAsaPbA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/CAEjqpHpkP5QSj6PcueNv8ruSK8mGsOyUnB9OsCPOOqyOe%3DHhBQ%40mail.gmail.com.
resource "aws_cloudformation_stack" "network" {
name = "networking-stack"
parameters {
availabilityZone1 = "us-east-1a"
sshKey = "xxx"
adminPassword = "abc"
imageName = "Best1000Mbps"
instanceType = "m3.2xlarge"
managementGuiPort = "8443"
}
template_body = "${file("cft.json")}"
}
ws_cloudformation_stack.network: Still creating... (2m20s elapsed)
aws_cloudformation_stack.network: Creation complete
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/CA%2BvtdQZdPmtt2xK1E9YfQJ7CKTonuX6NHUWevCoWEud8JyMWhQ%40mail.gmail.com.
provider "aws" {
region = "us-east-1"
}
resource "aws_cloudformation_stack" "network" {
name = "networking-stack"
parameters {
sshKey = "kkk"
availabilityZone1 = "us-east-1a"
adminPassword = "cisco123"
imageName = "Best1000Mbps"
instanceType = "m3.2xlarge"
managementGuiPort = "8443"
}
template_body = "${file("cft.json")}"
}
provider "aws" {
region = "us-east-1"
}
resource "aws_cloudformation_stack" "network" {
name = "networking-stack"
parameters {
sshKey = "kkk"
availabilityZone1 = "us-east-1a"
adminPassword = "cisco123"
imageName = "Best1000Mbps"
instanceType = "m3.2xlarge"
managementGuiPort = "8443"
}
template_body = "${file("cft.json")}"
}