Skip to content

Commit d025bb5

Browse files
authored
Merge pull request #6 from rafikurnia/develop/add-max-session-duration-support
Add `max_session_duration` support
2 parents 8cffded + ff1c5db commit d025bb5

File tree

26 files changed

+98
-97
lines changed

26 files changed

+98
-97
lines changed

README.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,63 @@
11
terraform-aws-iam-role
22
======================
3-
43
Terraform module to create AWS IAM Role.
54
Currently supported type of Roles are:
65
1. Role for AWS Service
76
2. Role for IAM User
87
3. Role for External AWS Account
8+
4. Role for Instance Profile
9+
910

1011
Usage
1112
-----
12-
1313
This module will only create an IAM Role and its Trust Relationships policy document. You need to attach your own Permission policy document outside the module.
1414

1515
To use a particular type of supported role, you can go into `modules` folder and read `README.md` at each subfolder for more detailed information.
1616

1717
To understand better on how to implement this module, you can go into `examples` folder and try them.
1818

19+
1920
Modules
2021
--------
21-
2222
* [AWS Service](https://github.com/traveloka/terraform-aws-iam-role/tree/master/modules/service)
2323
* [IAM User](https://github.com/traveloka/terraform-aws-iam-role/tree/master/modules/user)
2424
* [External AWS Account](https://github.com/traveloka/terraform-aws-iam-role/tree/master/modules/external)
25+
* [Instance Profile](https://github.com/traveloka/terraform-aws-iam-role/tree/master/modules/instance)
26+
2527

2628
Examples
2729
--------
30+
* [Service Role for Config](https://github.com/traveloka/terraform-aws-iam-role/tree/master/examples/aws-service-config)
31+
* [IAM Role for User](https://github.com/traveloka/terraform-aws-iam-role/tree/master/examples/user-iam)
32+
* [IAM Role for 3rd Party AWS Account](https://github.com/traveloka/terraform-aws-iam-role/tree/master/examples/external-account)
33+
* [IAM Role for Instance Profile](https://github.com/traveloka/terraform-aws-iam-role/tree/master/examples/instance-profile)
34+
2835

29-
* [Service Role for Config](https://github.com/traveloka/terraform-aws-iam-role/tree/master/examples/aws_service_config)
30-
* [IAM Role for 3rd Party AWS Account](https://github.com/traveloka/terraform-aws-iam-role/tree/master/examples/external_account)
31-
* [IAM Role for User](https://github.com/traveloka/terraform-aws-iam-role/tree/master/examples/user_iam)
36+
Tests
37+
-----
38+
To run the test:
39+
1. Install Ruby with version specified in the [Gemfile](https://github.com/traveloka/terraform-aws-iam-role/tree/master/Gemfile).
40+
2. Install bundler: `gem install bundler`
41+
3. Install gems: `bundle install`
42+
4. Run test from the root of the repository: `bundle exec kitchen test`
3243

3344

3445
Terraform Version
3546
-----------------
36-
3747
This module was created using Terraform 0.11.4.
3848
So to be more safe, Terraform version 0.11.4 or newer is required to use this module.
3949

4050

51+
AWS Provider Version
52+
--------------------
53+
Minimum required version for AWS Provider is 1.14.0
54+
55+
4156
Authors
4257
-------
43-
4458
* [Rafi Kurnia Putra](https://github.com/rafikurnia)
4559

60+
4661
License
4762
-------
48-
49-
Apache 2 Licensed. See LICENSE for full details.
63+
Apache 2 Licensed. See LICENSE for full details.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
example/aws_service_config
2+
==========================
3+
4+
This example will create an IAM Role for AWS Config.

examples/aws_service_config/main.tf renamed to examples/aws-service-config/main.tf

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
provider "aws" {
2-
version = "~> 1.13.0"
3-
region = "ap-southeast-1"
2+
region = "ap-southeast-1"
43
}
54

65
module "this" {
7-
source = "../../modules/service" # In actual use case, you have to replace this line with: source = "github.com/traveloka/terraform-aws-iam-role.git//modules/service?ref=0.0.1"
6+
# In actual use case, you have to replace the following line (line 8) with:
7+
# source = "github.com/traveloka/terraform-aws-iam-role.git//modules/service?ref=v0.3.0"
8+
source = "../../modules/service"
89

910
role_identifier = "Default Config"
1011
role_description = "Service Role for Default AWS Config"
1112
role_force_detach_policies = false
12-
aws_service = "config.amazonaws.com"
13+
role_max_session_duration = 43200
14+
15+
aws_service = "config.amazonaws.com"
1316
}
1417

1518
resource "aws_iam_role_policy_attachment" "this" {
File renamed without changes.

examples/aws_service_config/README.md

Lines changed: 0 additions & 4 deletions
This file was deleted.
File renamed without changes.

examples/external_account/main.tf renamed to examples/external-account/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
# This example was created using terraform-provider-aws version 1.13.0 at 2018/04/03.
21
provider "aws" {
3-
version = "~> 1.13.0"
4-
region = "ap-southeast-1"
2+
region = "ap-southeast-1"
53
}
64

75
module "this" {
8-
source = "../../modules/external" # In actual use case, you have to replace this line with: source = "github.com/traveloka/terraform-aws-iam-role.git//modules/external?ref=0.0.1"
6+
# In actual use case, you have to replace the following line (line 8) with:
7+
# source = "github.com/traveloka/terraform-aws-iam-role.git//modules/external?ref=v0.3.0"
8+
source = "../../modules/external"
99

1010
role_name = "ThirdPartyName" # Replace this value with the name given by 3rd party, or define it by yourself with clear and describing name
1111
role_path = "/external/security/"
1212
role_description = "Role for ThirdParty"
1313
role_force_detach_policies = true
14+
role_max_session_duration = 43200
1415

1516
account_id = "123456789012" # Replace this with 3rd party's AWS Account ID
16-
external_id = "ABCDEFGHIJ01" # Only set this value if the 3rd party ask you to
17+
external_id = "ABCDEFGHIJ01" # Don't set the value if not needed, only set this value if the 3rd party ask you to specify external_id.
1718
}
1819

1920
resource "aws_iam_role_policy_attachment" "this" {
File renamed without changes.

examples/instance-profile/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
provider "aws" {
2-
version = "1.13.0"
3-
region = "ap-southeast-1"
2+
region = "ap-southeast-1"
43
}
54

65
module "this" {
7-
source = "../../modules/instance" # In actual use case, you have to replace this line with: source = "github.com/traveloka/terraform-aws-iam-role.git//modules/instance?ref=0.2.0"
6+
# In actual use case, you have to replace the following line (line 8) with:
7+
# source = "github.com/traveloka/terraform-aws-iam-role.git//modules/instance?ref=v0.3.0"
8+
source = "../../modules/instance"
89

910
service_name = "txtdata"
1011
cluster_role = "app"
File renamed without changes.

0 commit comments

Comments
 (0)