Skip to content
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

Check if IAM role already exists and then skip creating new one. #2

Open
san089 opened this issue Jan 30, 2020 · 0 comments
Open

Check if IAM role already exists and then skip creating new one. #2

san089 opened this issue Jan 30, 2020 · 0 comments
Assignees

Comments

@san089
Copy link
Owner

san089 commented Jan 30, 2020

Check if IAM role already exists and then skip creating a new one.

try:
        create_response = iam_client.create_role(
                    Path='/',
                    RoleName=role_name,
                    Description=role_description,
                    AssumeRolePolicyDocument = role_policy_document
        )
        logger.debug(f"Got response from IAM client for creating role : {create_response}")
        logger.info(f"Role create response code : {create_response['ResponseMetadata']['HTTPStatusCode']}")
    except Exception as e:
        logger.error(f"Error occured while creating role : {e}")
        return False
@san089 san089 self-assigned this Jan 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant