diff --git a/.terraform-docs.yml b/.terraform-docs.yml new file mode 100644 index 0000000..418f24a --- /dev/null +++ b/.terraform-docs.yml @@ -0,0 +1,45 @@ +formatter: markdown table + +header-from: main.tf +footer-from: "" + +sections: +## hide: [] + show: + - data-sources + - header + - footer + - inputs + - modules + - outputs + - providers + - requirements + - resources + +output: + file: README.md + mode: replace +# mode: inject +# template: |- +# +# {{ .Content }} +# + +## output-values: +## enabled: false +## from: "" +## +## sort: +## enabled: true +## by: name +## +## settings: +## anchor: true +## color: true +## default: true +## description: false +## escape: true +## indent: 2 +## required: true +## sensitive: true +## type: true diff --git a/rolesanywhere/.terraform-docs.yml b/rolesanywhere/.terraform-docs.yml new file mode 120000 index 0000000..f095125 --- /dev/null +++ b/rolesanywhere/.terraform-docs.yml @@ -0,0 +1 @@ +../.terraform-docs.yml \ No newline at end of file diff --git a/rolesanywhere/README.md b/rolesanywhere/README.md index aac82ca..b12cdf6 100644 --- a/rolesanywhere/README.md +++ b/rolesanywhere/README.md @@ -1,3 +1,4 @@ + ## Requirements | Name | Version | @@ -63,3 +64,4 @@ |------|-------------| | [role\_arn](#output\_role\_arn) | Created role ARN | | [role\_name](#output\_role\_name) | Created role name | + \ No newline at end of file diff --git a/rolesanywhere/main.tf b/rolesanywhere/main.tf index bca1dd9..e9f4df5 100644 --- a/rolesanywhere/main.tf +++ b/rolesanywhere/main.tf @@ -14,3 +14,57 @@ locals { role_name = format("%v%v", lookup(local._prefixes, "role", ""), var.role_name) role_description = var.role_description == "" ? format("%vRole for %v", local.saml_string, var.role_name) : var.role_description } + + +/* +* # About aws-iam-role/rolesanywhere +* +* This module will create an IAM RolesAnywhere role, profile, and certificate from ACM-PCA. +* +* ## Policies +* +* When using `attached_policies`, it is important those policy ARNs exist before attempting to use the module +* with `plan` or `apply`. The module is called with an unknown value and it fails if not. You'll need to target your +* first apply with that of the policy like: +* +* ```shell +* tf-apply -target=aws_iam_policy.mypolicy +* ``` +* +* # Usage +* +* Creating a role. +* ```hcl +* module "myrole2" { +* source = "git@github.e.it.census.gov:terraform-modules/aws-iam-role.git" +* role_name = "my-role2" +* attached_policies = [ data.aws_iam_policy.aws-managed-readonlyaccess.arn ] +* contact_group_email = "group-email-address@census.gov" +* } +* ``` +* +* Creating a with inline policies and a different OU for the certificate +* ```hcl +* data "aws_iam_document_policy" "my-policy-1" { +* statement { +* sid = "NameOfPermissiosn" +* # rest of stuff +* } +* } +* +* module "myrole3" { +* source = "git@github.e.it.census.gov:terraform-modules/aws-iam-role.git" +* +* role_name = "my-role3" +* attached_policies = [ data.aws_iam_policy.aws-managed-readonlyaccess.arn ] +* contact_group_email = "group-email-address@census.gov" +* certificate_conditions = { "x509Subject/OU" = "MyRolesAnywhere" } +* inline_policies = [ +* { +* name = "my-policy-1" +* policy = data.aws_iam_policy_document.my-policy-1.json +* } +* ] +* } +* ``` +*/