Skip to content

Instantly share code, notes, and snippets.

@joaquinclearmetal
Created November 6, 2019 23:47
Show Gist options
  • Save joaquinclearmetal/8d2d6a0e9c798dca968c3883a88889c6 to your computer and use it in GitHub Desktop.
Save joaquinclearmetal/8d2d6a0e9c798dca968c3883a88889c6 to your computer and use it in GitHub Desktop.
iam-user.main.tf
module "label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.14.1"
namespace = var.namespace
stage = var.stage
name = var.name
attributes = var.attributes
delimiter = var.delimiter
tags = var.tags
enabled = var.enabled
}
# Defines a user that should be able to write to you test bucket
resource "aws_iam_user" "default" {
count = var.enabled ? 1 : 0
name = module.label.id
path = var.path
force_destroy = var.force_destroy
}
# Generate API credentials
resource "aws_iam_access_key" "default" {
count = var.enabled ? 1 : 0
user = aws_iam_user.default[0].name
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment