From ec76e31f31b179dc606cf6abdec6848de9b90794 Mon Sep 17 00:00:00 2001
From: Tom Warnock <twarnock@2ndwatch.com>
Date: Tue, 19 May 2020 09:32:02 -0400
Subject: [PATCH] iam role add

---
 Makefile                   | 2 +-
 cloudendure/__version__.py | 2 +-
 cloudendure/cloudendure.py | 7 ++++---
 pyproject.toml             | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index 2c58cef53..8a2947cce 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ SHA1 := $$(git log -1 --pretty=%h)
 CURRENT_BRANCH := $$(git symbolic-ref -q --short HEAD)
 LATEST_TAG := ${REPO_NAME}:latest
 GIT_TAG := ${REPO_NAME}:${SHA1}
-VERSION := v0.2.9
+VERSION := v0.3.0
 
 info: ## Show information about the current git state.
 	@echo "Github Project: https://github.com/${REPO_NAME}\nCurrent Branch: ${CURRENT_BRANCH}\nSHA1: ${SHA1}\n"
diff --git a/cloudendure/__version__.py b/cloudendure/__version__.py
index 75cf7831c..493f7415d 100644
--- a/cloudendure/__version__.py
+++ b/cloudendure/__version__.py
@@ -1 +1 @@
-__version__ = "0.2.9"
+__version__ = "0.3.0"
diff --git a/cloudendure/cloudendure.py b/cloudendure/cloudendure.py
index 7054071cd..feeffd3e5 100644
--- a/cloudendure/cloudendure.py
+++ b/cloudendure/cloudendure.py
@@ -8,7 +8,6 @@
 import json
 import os
 import pprint
-from datetime import datetime, timezone
 from typing import Any, Dict, List
 
 import boto3
@@ -67,6 +66,7 @@ def __init__(
         if self.subnet_id and not self.private_ip_action:
             self.private_ip_action = "CREATE_NEW"
         self.security_group_id: str = self.config.active_config.get("security_group_id", "")
+        self.iam_role: str = self.config.active_config.get("iam_role", "")
         self.target_machines: List[str] = self.config.active_config.get("machines", "").split(",")
         self.target_machines = [x.upper() for x in self.target_machines]
         self.target_instance_types: List[str] = self.config.active_config.get("instance_types", "").split(",")
@@ -448,8 +448,7 @@ def check_licenses(self) -> Dict[str, Any]:
         return response_dict
 
     def get_machine_sync_details(self) -> List[Any]:
-        """Checks CloudEndure Project inventory and returns register machine's
-        replication state.
+        """Checks CloudEndure Project inventory and returns register machine replication state.
         """
         response_list: List[Any] = []
         print(f"INFO: Retreiving sync status for all machines in Project: ({self.project_name})")
@@ -557,6 +556,8 @@ def update_blueprint(self) -> bool:
                     blueprint["privateIPAction"] = self.private_ip_action
                 if self.security_group_id:
                     blueprint["securityGroupIDs"] = [self.security_group_id]
+                if self.iam_role:
+                    blueprint["iamRole"] = self.iam_role
 
                 instance_type = self.target_instances.get(_machine_name, "")
                 if instance_type:
diff --git a/pyproject.toml b/pyproject.toml
index af2ba39d6..56eae9e6a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "cloudendure"
-version = "0.2.9"
+version = "0.3.0"
 description = "Python wrapper and CLI for CloudEndure"
 authors = ["Mark Beacom <mark@markbeacom.com>", "Tom Warnock <twarnock@2ndwatch.com>"]
 maintainers = ["Evan Lucchesi <evan@2ndwatch.com>", "Nick Selpa <nselpa@2ndwatch.com>"]