Skip to content

updated to terraform v.012 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions codedeploy.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ resource "aws_codedeploy_app" "main" {

# create a deployment group
resource "aws_codedeploy_deployment_group" "main" {
app_name = "${aws_codedeploy_app.main.name}"
app_name = aws_codedeploy_app.main.name
deployment_group_name = "Sample_DepGroup"
service_role_arn = "${aws_iam_role.codedeploy_service.arn}"
service_role_arn = aws_iam_role.codedeploy_service.arn

deployment_config_name = "CodeDeployDefault.OneAtATime" # AWS defined deployment config

ec2_tag_filter = {
ec2_tag_filter {
key = "Name"
type = "KEY_AND_VALUE"
value = "CodeDeployDemo"
Expand Down
2 changes: 1 addition & 1 deletion key_pair.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "aws_key_pair" "main" {
key_name = "code-deploy-demo"
public_key = "${file(var.public_key_path)}"
public_key = file(var.public_key_path)
}
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ data "aws_ami" "amzn-linux" {
name = "name"
values = ["amzn-ami-*-x86_64-gp2"]
}
owners = ["amazon"]
}
4 changes: 2 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
output bucket_name {
value = "${aws_s3_bucket.b.bucket_domain_name}"
value = aws_s3_bucket.b.bucket_domain_name
}

output instance_ip {
value = "${aws_instance.main.public_ip}"
value = aws_instance.main.public_ip
}
2 changes: 1 addition & 1 deletion providers.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
provider aws {
region = "${var.region}"
region = var.region
}

provider random {}
6 changes: 3 additions & 3 deletions roles.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ EOF
# attach AWS managed policy called AWSCodeDeployRole
# required for deployments which are to an EC2 compute platform
resource "aws_iam_role_policy_attachment" "codedeploy_service" {
role = "${aws_iam_role.codedeploy_service.name}"
role = aws_iam_role.codedeploy_service.name
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSCodeDeployRole"
}

Expand Down Expand Up @@ -53,11 +53,11 @@ EOF

# provide ec2 access to s3 bucket to download revision. This role is needed by the CodeDeploy agent on EC2 instances.
resource "aws_iam_role_policy_attachment" "instance_profile_codedeploy" {
role = "${aws_iam_role.instance_profile.name}"
role = aws_iam_role.instance_profile.name
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforAWSCodeDeploy"
}

resource "aws_iam_instance_profile" "main" {
name = "codedeploy-instance-profile"
role = "${aws_iam_role.instance_profile.name}"
role = aws_iam_role.instance_profile.name
}