Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tf_mod_aws_iam_assume_role
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
steamhaus
tf_mod_aws_iam_assume_role
Commits
b59857df
Commit
b59857df
authored
Dec 05, 2016
by
A-Gordon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial commit
parents
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
188 additions
and
0 deletions
+188
-0
README.md
README.md
+11
-0
assume_role.json
assume_role.json
+18
-0
main.tf
main.tf
+58
-0
steamhaus_apn_policy.json
steamhaus_apn_policy.json
+101
-0
No files found.
README.md
0 → 100644
View file @
b59857df
#############################################################################################################
# IAM
#############################################################################################################
module "iam_role" {
source = "../../../steamhaus/tf_mod_aws_iam_assume_role/"
name = "${var.name}"
source_account_id = "${var.source_account_id}"
steamhaus_apn = "0"
admin = "1"
}
\ No newline at end of file
assume_role.json
0 → 100644
View file @
b59857df
{
"Version"
:
"2012-10-17"
,
"Statement"
:
[
{
"Effect"
:
"Allow"
,
"Principal"
:
{
"AWS"
:
"arn:aws:iam::${source_account_id}:root"
},
"Action"
:
"sts:AssumeRole"
,
"Condition"
:
{
"Bool"
:
{
"aws:MultiFactorAuthPresent"
:
"true"
}
}
}
]
}
\ No newline at end of file
main.tf
0 → 100644
View file @
b59857df
#############################################################################################################
# Variables
#############################################################################################################
variable
"name"
{
description
=
"Name of the role that will be assumed"
}
variable
"source_account_id"
{
description
=
"ID of the source AWS account to be allowed accesss"
}
variable
"steamhaus_apn"
{
description
=
""
default
=
"1"
}
variable
"admin"
{
description
=
""
default
=
"0"
}
#############################################################################################################
# IAM Role, Policy and Attachment
#############################################################################################################
data
"template_file"
"assume_role"
{
template
=
"
${
file
(
"
${
path
.
module}
/assume_role.json"
)
}
"
vars
{
source_account_id
=
"
${
var
.
source_account_id
}
"
}
}
resource
"aws_iam_role"
"role"
{
name
=
"
${
var
.
name
}
"
assume_role_policy
=
"
${data
.
template_file
.
assume_role
.
rendered
}
"
lifecycle
{
create_before_destroy
=
true
}
}
resource
"aws_iam_policy"
"steamhaus_apn"
{
name
=
"SteamhausAPN"
description
=
"Steamhaus APN policy"
policy
=
"
${
file
(
"
${
path
.
module}
/steamhaus_apn_policy.json"
)
}
"
count
=
"
${
var
.
steamhaus_apn
}
"
lifecycle
{
create_before_destroy
=
true
}
}
resource
"aws_iam_role_policy_attachment"
"steamhaus_apn"
{
role
=
"
${
aws_iam_role
.
role
.
name
}
"
policy_arn
=
"
${
aws_iam_policy
.
steamhaus_apn
.
arn
}
"
count
=
"
${
var
.
steamhaus_apn
}
"
}
resource
"aws_iam_role_policy_attachment"
"admin"
{
role
=
"
${
aws_iam_role
.
role
.
name
}
"
policy_arn
=
"arn:aws:iam::aws:policy/AdministratorAccess"
count
=
"
${
var
.
admin
}
"
}
\ No newline at end of file
steamhaus_apn_policy.json
0 → 100644
View file @
b59857df
{
"Version"
:
"2012-10-17"
,
"Statement"
:
[
{
"Action"
:
[
"iam:AddRoleToInstanceProfile"
,
"iam:AddClientIDToOpenIDConnectProvider"
,
"iam:AttachGroupPolicy"
,
"iam:AttachRolePolicy"
,
"iam:AttachUserPolicy"
,
"iam:CreateAccountAlias"
,
"iam:CreateGroup"
,
"iam:CreateInstanceProfile"
,
"iam:CreateLoginProfile"
,
"iam:CreateOpenIDConnectProvider"
,
"iam:CreatePolicy"
,
"iam:CreatePolicyVersion"
,
"iam:CreateRole"
,
"iam:CreateSAMLProvider"
,
"iam:CreateUser"
,
"iam:DeleteAccountAlias"
,
"iam:DeleteAccountPasswordPolicy"
,
"iam:DeleteGroup"
,
"iam:DeleteGroupPolicy"
,
"iam:DeleteInstanceProfile"
,
"iam:DeleteLoginProfile"
,
"iam:DeleteOpenIDConnectProvider"
,
"iam:DeletePolicy"
,
"iam:DeletePolicyVersion"
,
"iam:DeleteRole"
,
"iam:DeleteRolePolicy"
,
"iam:DeleteSAMLProvider"
,
"iam:DeleteSSHPublicKey"
,
"iam:DeleteServerCertificate"
,
"iam:DeleteSigningCertificate"
,
"iam:DeleteUser"
,
"iam:DeleteUserPolicy"
,
"iam:DeleteVirtualMFADevice"
,
"iam:DetachGroupPolicy"
,
"iam:DetachRolePolicy"
,
"iam:DetachUserPolicy"
,
"iam:GenerateCredentialReport"
,
"iam:GenerateServiceLastAccessedDetails"
,
"iam:GetAccessKeyLastUsed"
,
"iam:GetAccountAuthorizationDetails"
,
"iam:GetAccountPasswordPolicy"
,
"iam:GetAccountSummary"
,
"iam:GetContextKeysForCustomPolicy"
,
"iam:GetContextKeysForPrincipalPolicy"
,
"iam:GetCredentialReport"
,
"iam:GetInstanceProfile"
,
"iam:GetLoginProfile"
,
"iam:GetOpenIDConnectProvider"
,
"iam:GetPolicy"
,
"iam:GetPolicyVersion"
,
"iam:GetRole"
,
"iam:GetRolePolicy"
,
"iam:GetSAMLProvider"
,
"iam:GetSSHPublicKey"
,
"iam:GetServerCertificate"
,
"iam:GetServiceLastAccessedDetails"
,
"iam:GetServiceLastAccessedDetailsWithEntities"
,
"iam:GetUser"
,
"iam:GetUserPolicy"
,
"iam:PassRole"
,
"iam:PutGroupPolicy"
,
"iam:PutRolePolicy"
,
"iam:PutUserPolicy"
,
"iam:RemoveClientIDFromOpenIDConnectProvider"
,
"iam:RemoveRoleFromInstanceProfile"
,
"iam:RemoveUserFromGroup"
,
"iam:SetDefaultPolicyVersion"
,
"iam:SimulateCustomPolicy"
,
"iam:SimulatePrincipalPolicy"
,
"iam:UpdateAccountPasswordPolicy"
,
"iam:UpdateAssumeRolePolicy"
,
"iam:UpdateGroup"
,
"iam:UpdateLoginProfile"
,
"iam:UpdateOpenIDConnectProviderThumbprint"
,
"iam:UpdateSAMLProvider"
,
"iam:UpdateSSHPublicKey"
,
"iam:UpdateServerCertificate"
,
"iam:UpdateSigningCertificate"
,
"iam:UpdateUser"
,
"iam:UploadSSHPublicKey"
,
"iam:UploadServerCertificate"
,
"iam:UploadSigningCertificate"
,
"support:*"
,
"aws-portal:*"
],
"Effect"
:
"Deny"
,
"Resource"
:
"*"
},
{
"Effect"
:
"Allow"
,
"Action"
:
"*"
,
"Resource"
:
"*"
}
]
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment