Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
terraform-aws-iam
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Terraform Modules
terraform-aws-iam
Commits
c2343ee8
Unverified
Commit
c2343ee8
authored
Sep 10, 2021
by
Gabriel Suarez
Committed by
GitHub
Sep 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Add ability for controlling whether or not to create a policy (#163)
parent
37d5168d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
8 deletions
+22
-8
README.md
examples/iam-policy/README.md
+1
-0
main.tf
examples/iam-policy/main.tf
+6
-0
README.md
modules/iam-policy/README.md
+1
-0
main.tf
modules/iam-policy/main.tf
+2
-1
outputs.tf
modules/iam-policy/outputs.tf
+6
-7
variables.tf
modules/iam-policy/variables.tf
+6
-0
No files found.
examples/iam-policy/README.md
View file @
c2343ee8
...
...
@@ -34,6 +34,7 @@ Run `terraform destroy` when you don't need these resources.
|------|--------|---------|
|
<a
name=
"module_iam_policy"
></a>
[
iam\_policy
](
#module\_iam\_policy
)
| ../../modules/iam-policy | |
|
<a
name=
"module_iam_policy_from_data_source"
></a>
[
iam\_policy\_from\_data\_source
](
#module\_iam\_policy\_from\_data\_source
)
| ../../modules/iam-policy | |
|
<a
name=
"module_iam_policy_optional"
></a>
[
iam\_policy\_optional
](
#module\_iam\_policy\_optional
)
| ../../modules/iam-policy | |
## Resources
...
...
examples/iam-policy/main.tf
View file @
c2343ee8
...
...
@@ -53,3 +53,9 @@ module "iam_policy_from_data_source" {
PolicyDescription
=
"Policy created using example from data source"
}
}
module
"iam_policy_optional"
{
source
=
"../../modules/iam-policy"
create_policy
=
false
}
\ No newline at end of file
modules/iam-policy/README.md
View file @
c2343ee8
...
...
@@ -30,6 +30,7 @@ No modules.
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
|
<a
name=
"input_create_policy"
></a>
[
create\_policy
](
#input\_create\_policy
)
| Whether to create the IAM policy |
`bool`
|
`true`
| no |
|
<a
name=
"input_description"
></a>
[
description
](
#input\_description
)
| The description of the policy |
`string`
|
`"IAM Policy"`
| no |
|
<a
name=
"input_name"
></a>
[
name
](
#input\_name
)
| The name of the policy |
`string`
|
`""`
| no |
|
<a
name=
"input_path"
></a>
[
path
](
#input\_path
)
| The path of the policy in IAM |
`string`
|
`"/"`
| no |
...
...
modules/iam-policy/main.tf
View file @
c2343ee8
resource
"aws_iam_policy"
"policy"
{
count
=
var
.
create_policy
?
1
:
0
name
=
var
.
name
path
=
var
.
path
description
=
var
.
description
...
...
@@ -7,4 +9,3 @@ resource "aws_iam_policy" "policy" {
tags
=
var
.
tags
}
modules/iam-policy/outputs.tf
View file @
c2343ee8
output
"id"
{
description
=
"The policy's ID"
value
=
aws_iam_policy
.
policy
.
id
value
=
element
(
concat
(
aws_iam_policy
.
policy
.*.
id
,
[
""
]
),
0
)
}
output
"arn"
{
description
=
"The ARN assigned by AWS to this policy"
value
=
aws_iam_policy
.
policy
.
arn
value
=
element
(
concat
(
aws_iam_policy
.
policy
.*.
arn
,
[
""
]
),
0
)
}
output
"description"
{
description
=
"The description of the policy"
value
=
aws_iam_policy
.
policy
.
description
value
=
element
(
concat
(
aws_iam_policy
.
policy
.*.
description
,
[
""
]
),
0
)
}
output
"name"
{
description
=
"The name of the policy"
value
=
aws_iam_policy
.
policy
.
name
value
=
element
(
concat
(
aws_iam_policy
.
policy
.*.
name
,
[
""
]
),
0
)
}
output
"path"
{
description
=
"The path of the policy in IAM"
value
=
aws_iam_policy
.
policy
.
path
value
=
element
(
concat
(
aws_iam_policy
.
policy
.*.
path
,
[
""
]
),
0
)
}
output
"policy"
{
description
=
"The policy document"
value
=
aws_iam_policy
.
policy
.
policy
value
=
element
(
concat
(
aws_iam_policy
.
policy
.*.
policy
,
[
""
]
),
0
)
}
modules/iam-policy/variables.tf
View file @
c2343ee8
variable
"create_policy"
{
description
=
"Whether to create the IAM policy"
type
=
bool
default
=
true
}
variable
"name"
{
description
=
"The name of the policy"
type
=
string
...
...
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