Skip to content

Commit

Permalink
Fix refactoring error
Browse files Browse the repository at this point in the history
  • Loading branch information
deedubs committed May 29, 2018
1 parent cdd0175 commit 05052d2
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

aws-hostname
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export GOOS=linux

BIN=aws-hostname

$(BIN): main.go
go build -o $(BIN) main.go
19 changes: 18 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,24 @@ func main() {
}

if setEc2Tag {
writeTag(identity.InstanceID, "Name", *hostname)
svc := ec2.New(session.New())

input := &ec2.CreateTagsInput{
Resources: []*string{
aws.String(identity.InstanceID),
},
Tags: []*ec2.Tag{
{
Key: aws.String("Name"),
Value: aws.String(*hostname),
},
},
}

_, err := svc.CreateTags(input)
if err != nil {
log.Fatal(err)
}
}

if setHostname {
Expand Down

0 comments on commit 05052d2

Please sign in to comment.