Module: iam-chamber-s3-role
Terraform module to provision an IAM role with configurable permissions to access S3 Bucket used by Chamber as Parameter Store backend.
Usage
This example creates a role with the name cp-prod-app
with permission to use Chamber with S3 bucket as parameter store,
and gives permission to the entities specified in assume_role_arns
to assume the role.
module "chamber_s3_role" {
source = "cloudposse/iam-chamber-s3-role/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
enabled = true
namespace = "eg"
stage = "prod"
name = "app"
principals_arns = "${local.kops_roles}"
bucket_arn = "arn:aws:s3:::bucket_name"
services = ["app", "staging", "default"]
read_only = false
}
Examples
For a complete example, see examples/complete.
For automated tests of the complete example using bats and Terratest (which tests and deploys the example on AWS), see test.
Variables
Required Variables
bucket_arn
(string
) requiredARN of S3 bucket
Optional Variables
max_session_duration
(number
) optionalThe maximum session duration (in seconds) for the role. Can have a value from 1 hour to 12 hours
Default value:
3600
policy_description
(string
) optionalThe description of the IAM policy that is visible in the IAM policy manager
Default value:
"Policy to access S3 bucket"
principals_arns
(list(string)
) optionalList of ARNs to allow assuming the role. Could be AWS services or accounts, Kops nodes, IAM users or groups
Default value:
[ ]
read_only
(bool
) optionalSet to
true
to deny write actions for bucketDefault value:
false
role_description
(string
) optionalThe description of the IAM role that is visible in the IAM role manager
Default value:
"Role to access S3 bucket"
role_enabled
(bool
) optionalSet to
false
to prevent the module from creating IAM roleDefault value:
true
services
(list(string)
) optionalNames of chamber services
Default value:
[ ]
Context Variables
The following variables are defined in the context.tf
file of this module and part of the terraform-null-label pattern.
context.tf
file of this module and part of the terraform-null-label pattern.Outputs
role_arn
The Amazon Resource Name (ARN) specifying the role
role_id
The stable and unique string identifying the role
role_name
The name of the IAM role created
role_policy_document
IAM policy to access chamber S3
Dependencies
Requirements
terraform
, version:>= 0.13.0
aws
, version:>= 2.0
null
, version:>= 2.0
Providers
aws
, version:>= 2.0
Modules
Name | Version | Source | Description |
---|---|---|---|
role | 0.13.0 | cloudposse/iam-role/aws | n/a |
this | 0.25.0 | cloudposse/label/null | n/a |
Resources
The following resources are used by this module:
Data Sources
The following data sources are used by this module:
aws_iam_policy_document.base
(data source)aws_iam_policy_document.resource_full_access
(data source)aws_iam_policy_document.resource_readonly_access
(data source)