Skip to content

Commit c6cdc7b

Browse files
authored
Merge pull request #41 from opszero/fix-tag
fix tags
2 parents 5a4f832 + 9dc99f7 commit c6cdc7b

File tree

9 files changed

+545
-7
lines changed

9 files changed

+545
-7
lines changed

.gitignore

Lines changed: 211 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,211 @@
1-
.vscode
1+
.vscode
2+
# ignored files
3+
*~
4+
5+
# temporary files which can be created if a process still has a handle open of a deleted file
6+
.fuse_hidden*
7+
8+
# KDE directory preferences
9+
.directory
10+
11+
# Linux trash folder which might appear on any partition or disk
12+
.Trash-*
13+
14+
# .nfs files are created when an open file is removed but is still being accessed
15+
.nfs*
16+
### Eclipse template
17+
18+
.metadata
19+
bin/
20+
tmp/
21+
*.tmp
22+
*.bak
23+
*.swp
24+
*~.nib
25+
local.properties
26+
.settings/
27+
.loadpath
28+
.recommenders
29+
30+
# External tool builders
31+
.externalToolBuilders/
32+
33+
# Locally stored "Eclipse launch configurations"
34+
*.launch
35+
36+
# PyDev specific (Python IDE for Eclipse)
37+
*.pydevproject
38+
39+
# CDT-specific (C/C++ Development Tooling)
40+
.cproject
41+
42+
# Java annotation processor (APT)
43+
.factorypath
44+
45+
# PDT-specific (PHP Development Tools)
46+
.buildpath
47+
48+
# sbteclipse plugin
49+
.target
50+
51+
# Tern plugin
52+
.tern-project
53+
54+
# TeXlipse plugin
55+
.texlipse
56+
57+
# STS (Spring Tool Suite)
58+
.springBeans
59+
60+
# Code Recommenders
61+
.recommenders/
62+
63+
# Scala IDE specific (Scala & Java development for Eclipse)
64+
.cache-main
65+
.scala_dependencies
66+
.worksheet
67+
### Windows template
68+
# Windows thumbnail cache files
69+
Thumbs.db
70+
ehthumbs.db
71+
ehthumbs_vista.db
72+
73+
# Dump file
74+
*.stackdump
75+
76+
# Folder config file
77+
[Dd]esktop.ini
78+
79+
# Recycle Bin used on file shares
80+
$RECYCLE.BIN/
81+
82+
# Windows Installer files
83+
*.cab
84+
*.msi
85+
*.msm
86+
*.msp
87+
88+
# Windows shortcuts
89+
*.lnk
90+
### Ansible template
91+
*.retry
92+
### macOS template
93+
# General
94+
.DS_Store
95+
.AppleDouble
96+
.LSOverride
97+
98+
# Icon must end with two \r
99+
Icon
100+
101+
# Thumbnails
102+
._*
103+
104+
# Files that might appear in the root of a volume
105+
.DocumentRevisions-V100
106+
.fseventsd
107+
.Spotlight-V100
108+
.TemporaryItems
109+
.Trashes
110+
.VolumeIcon.icns
111+
.com.apple.timemachine.donotpresent
112+
113+
# Directories potentially created on remote AFP share
114+
.AppleDB
115+
.AppleDesktop
116+
Network Trash Folder
117+
Temporary Items
118+
.apdisk
119+
### Archives template
120+
# It's better to unpack these files and commit the raw source because
121+
# git has its own built in compression methods.
122+
*.7z
123+
*.jar
124+
*.rar
125+
*.zip
126+
*.gz
127+
*.tgz
128+
*.bzip
129+
*.bz2
130+
*.xz
131+
*.lzma
132+
*.cab
133+
134+
# Packing-only formats
135+
*.iso
136+
*.tar
137+
138+
# Package management formats
139+
*.dmg
140+
*.xpi
141+
*.gem
142+
*.egg
143+
*.deb
144+
*.rpm
145+
*.msi
146+
*.msm
147+
*.msp
148+
### JetBrains template
149+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
150+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
151+
152+
/.idea/
153+
# User-specific stuff:
154+
.idea/**/workspace.xml
155+
.idea/**/tasks.xml
156+
.idea/dictionaries
157+
158+
# Sensitive or high-churn files:
159+
.idea/**/dataSources/
160+
.idea/**/dataSources.ids
161+
.idea/**/dataSources.xml
162+
.idea/**/dataSources.local.xml
163+
.idea/**/sqlDataSources.xml
164+
.idea/**/dynamic.xml
165+
.idea/**/uiDesigner.xml
166+
167+
# Gradle:
168+
.idea/**/gradle.xml
169+
.idea/**/libraries
170+
171+
# CMake
172+
cmake-build-debug/
173+
174+
# Mongo Explorer plugin:
175+
.idea/**/mongoSettings.xml
176+
177+
## File-based project format:
178+
*.iws
179+
180+
## Plugin-specific files:
181+
182+
# IntelliJ
183+
out/
184+
185+
# mpeltonen/sbt-idea plugin
186+
.idea_modules/
187+
# User-specific stuff:
188+
.idea/*
189+
# JIRA plugin
190+
atlassian-ide-plugin.xml
191+
192+
# Cursive Clojure plugin
193+
.idea/replstate.xml
194+
195+
# TFstste
196+
*.tfstate*
197+
198+
deployment/_logs/ansible-log.json
199+
deployment/_logs/ansible-log.log
200+
deployment/_logs/facts/*
201+
deployment/_logs/retry/*
202+
_app/*
203+
ansible-log.json
204+
.terraform
205+
terraform.tfstate
206+
207+
*.tfstate
208+
*.tfstate.backup
209+
*.iml
210+
*.terraform.lock.hcl
211+
*.lock.hcl

bitbucket.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module "bitbucket" {
22
for_each = var.bitbucket
33

4-
source = "github.com/opszero/terraform-aws-bitbucket-oidc"
4+
source = "github.com/opszero/terraform-aws-bitbucket-oidc?ref=v1.0.0"
55

66
workspace_name = each.value.workspace_name
77
workspace_uuid = each.value.workspace_uuid

github.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module "oidc-github" {
22
for_each = var.github
33

4-
source = "github.com/opszero/terraform-aws-oidc-github"
4+
source = "github.com/opszero/terraform-aws-oidc-github?ref=v1.0.0"
55

66
github_repositories = each.value.repos
77

gitlab.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
module "aws_oidc_gitlab" {
22

33
for_each = var.gitlab
4-
source = "github.com/abhiyerra/terraform-aws-oidc-gitlab"
5-
4+
source = "github.com/opszero/terraform-aws-oidc-gitlab?ref=v1.0.0"
65

76
attach_admin_policy = false
87
create_oidc_provider = true

groups.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
module "iam_group_with_policies" {
22
for_each = var.groups
33

4-
source = "terraform-aws-modules/iam/aws//modules/iam-group-with-policies"
5-
version = "~> 6"
4+
source = "./iam-group-with-policies"
65

76
name = each.key
87

iam-group-with-policies/main.tf

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
locals {
2+
group_name = var.create_group ? aws_iam_group.this[0].id : var.name
3+
}
4+
5+
resource "aws_iam_group" "this" {
6+
count = var.create_group ? 1 : 0
7+
8+
name = var.name
9+
path = var.path
10+
}
11+
12+
resource "aws_iam_group_membership" "this" {
13+
count = length(var.group_users) > 0 ? 1 : 0
14+
15+
group = local.group_name
16+
name = var.name
17+
users = var.group_users
18+
}
19+
20+
################################
21+
# IAM group policy attachements
22+
################################
23+
resource "aws_iam_group_policy_attachment" "iam_self_management" {
24+
count = var.attach_iam_self_management_policy ? 1 : 0
25+
26+
group = local.group_name
27+
policy_arn = aws_iam_policy.iam_self_management[0].arn
28+
}
29+
30+
resource "aws_iam_group_policy_attachment" "custom_arns" {
31+
count = length(var.custom_group_policy_arns)
32+
33+
group = local.group_name
34+
policy_arn = element(var.custom_group_policy_arns, count.index)
35+
}
36+
37+
resource "aws_iam_group_policy_attachment" "custom" {
38+
count = length(var.custom_group_policies)
39+
40+
group = local.group_name
41+
policy_arn = element(aws_iam_policy.custom[*].arn, count.index)
42+
}
43+
44+
###############
45+
# IAM policies
46+
###############
47+
resource "aws_iam_policy" "iam_self_management" {
48+
count = var.attach_iam_self_management_policy ? 1 : 0
49+
50+
name_prefix = var.iam_self_management_policy_name_prefix
51+
policy = data.aws_iam_policy_document.iam_self_management.json
52+
53+
tags = var.tags
54+
}
55+
56+
resource "aws_iam_policy" "custom" {
57+
count = length(var.custom_group_policies)
58+
59+
name = var.custom_group_policies[count.index]["name"]
60+
policy = var.custom_group_policies[count.index]["policy"]
61+
description = lookup(var.custom_group_policies[count.index], "description", null)
62+
63+
tags = var.tags
64+
}

iam-group-with-policies/outputs.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
output "aws_account_id" {
2+
description = "IAM AWS account id"
3+
value = local.aws_account_id
4+
}
5+
6+
output "group_arn" {
7+
description = "IAM group arn"
8+
value = try(aws_iam_group.this[0].arn, "")
9+
}
10+
11+
output "group_users" {
12+
description = "List of IAM users in IAM group"
13+
value = flatten(aws_iam_group_membership.this[*].users)
14+
}
15+
16+
output "group_name" {
17+
description = "IAM group name"
18+
value = try(aws_iam_group.this[0].name, var.name)
19+
}

0 commit comments

Comments
 (0)