terraform-provider-aws

Terraform AWS role policy fails when adding permissions

大兔子大兔子 提交于 2020-08-26 11:43:06
问题 I need to create some role policy for AWS using Terraform, the basic role works fine, but when I add S3 and logs, I get a malformed error: aws_iam_role.lambda_exec_role_s3: Error creating IAM Role lambda_exec_role_s3: MalformedPolicyDocument: Has prohibited field Resource status code: 400 This is the role policy that is failing: assume_role_policy = <<EOF { "Version": "2012-10-17", "Statement": [ { "Action": "sts:AssumeRole", "Principal": { "Service": "lambda.amazonaws.com" }, "Effect":

How to restart EC2 instance using terraform without destroying them?

牧云@^-^@ 提交于 2020-08-07 07:45:12
问题 I am wondering how can we stop and restart the AWS ec2 instance created using terraform. is there any way to do that? 回答1: As you asked, for example, there is a limit on the comment, so posting as the answer using local-exec . I assume that you already configure aws configure | aws configure --profile test using aws-cli. Here is the complete example to reboot an instance, change VPC SG ID, subnet and key name etc provider "aws" { region = "us-west-2" profile = "test" } resource "aws_instance"