title: Error in creating IAM role and attach policies to it
body: <p>I am trying to create a lambda role and attach policies to it so it can start and stop ec2 instance. I will be triggering the lambda using cloudwatch.</p>
  
  <p>I am getting this error: 
  "Error: Error creating IAM Role lambdaRole: MalformedPolicyDocument: JSON strings must not have leading spaces
          status code: 400, request id: d6a86c41-6601-43af-9040-81f6e6a76ec8</p>
  
  <p>on iam.tf line 11, in resource "aws_iam_role" "lambdaRole":
    11: resource "aws_iam_role" "lambdaRole" {"</p>
  
  <pre><code> terraform {
      backend  "s3" {
      region         = "us-west-2"
      bucket         = "gitlegionbucket"
      key            = "ec2/terraform.tfstate"
      dynamodb_table = "tf-state-lock"
      }
  }
  
  resource "aws_iam_role" "lambdaRole" {
    name = "lambdaRole"
  
    assume_role_policy = &lt;&lt;EOF
      {
        "Version": "2012-10-17",
        "Statement": [
          {
            "Action": "sts:AssumeRole",
            "Principal": {
            "Service": "ec2.amazonaws.com"
            },
            "Effect": "Allow",
            "Sid": ""
          }
        ]
      }
  EOF
  }
  
  resource "aws_iam_policy" "policy" {
    name        = "test-policy"
    policy = &lt;&lt;EOF
  {
    "Version": "2012-10-17",
    "Statement": [
      {
        "Effect": "Allow",
        "Action": [
          "logs:CreateLogGroup",
          "logs:CreateLogStream",
          "logs:PutLogEvents"
        ],
        "Resource": "arn:aws:logs:*:*:*"
      },
      {
        "Effect": "Allow",
        "Action": [
          "ec2:Start*",
          "ec2:Stop*"
        ],
        "Resource": "*"
      }
    ]
  }
  EOF
  }
  
  resource "aws_iam_role_policy_attachment" "attach-policies" {
    role       = "${aws_iam_role.lambdaRole.name}"
    policy_arn = "${aws_iam_policy.policy.arn}"
  }
  </code></pre>