To automate the creation of the IAM resources needed simply create a template that references the terraform-aws-Redislabs-Cloud-Account-IAM-Resources module, located in S3, as instructed below:

  1. create a main.tf as shown below (replacing the profile, region and pgp_key values for your own:
provider "aws" {
    profile = "tobyhf-admin"
    region = "us-east-1"
}

module "Redislabs-Cloud-Account-Resources" { source = "https://iam-resource-automation-do-not-delete.s3.amazonaws.com/terraform-aws-Redislabs-Cloud-Account-IAM-Resources.zip" pgp_key = "keybase:toby_h_ferguson" }

output "accessKeyId" { value = module.Redislabs-Cloud-Account-Resources.accessKeyId }

output "accessSecretKey" { value = module.Redislabs-Cloud-Account-Resources.accessSecretKey sensitive = true }

output "IAMRoleName" { value = module.Redislabs-Cloud-Account-Resources.IAMRoleName }

output "consoleUsername" { value = module.Redislabs-Cloud-Account-Resources.consoleUsername }

output "signInLoginUrl" { description = "Redis Labs User's console login URL" value = module.Redislabs-Cloud-Account-Resources.signInLoginUrl }

output "consolePassword" { value = module.Redislabs-Cloud-Account-Resources.consolePassword sensitive = true }

Notes:

  1. Initialize terraform with the module:

Note: Terraform requires AWS credentials be supplied, but the source of the module is a public S3 bucket so any valid credentials will do! Replace the XXXX fields below with your relevant values

AWS_ACCESS_KEY_ID=XXXX AWS_SECRET_KEY=XXXX terraform init
  1. Build the resources:
terraform apply

This will output the various data you need although you’ll have to access the sensitive data thus:

  • accessSecretKey: echo $(terraform output -raw accessSecretKey)
  • consolePassword: echo $(terraform output -raw consolePassword | base64 --decode | keybase pgp decrypt)