Skip to content

Coaktion/terraform-policies-module

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Policies Module

Terraform module to create policy and role dynamically.

Usage

data "aws_caller_identity" "current" {}
data "aws_region" "current" {}

module "policies" {
  source = "../"

  region     = data.aws_region.current.name
  account_id = data.aws_caller_identity.current.account_id

  policies = [
    {
      iam_reference = "username-iam"
      iam_type      = "user"
      statements = [
        {
          actions   = ["s3:GetObject", "s3:PutObject", "s3:ListBucket"]
          resources = ["arn:aws:s3:::callwe-integration-service/*"]
        },
        {
          actions   = ["logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents"]
          resources = ["arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/*"]
        }
      ]
    },
    {
      iam_reference = "lambda-role-name"
      iam_type      = "role"
      statements = [
        {
          actions = ["s3:GetObject", "s3:PutObject", "s3:ListBucket"]
          resources = [
            "arn:aws:s3:::callwe-integration-service/*",
            "arn:aws:s3:::callwe-integration-service-dev/*"
          ]
        },
        {
          actions   = ["logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents"]
          resources = ["arn:aws:logs:us-east-1:123456789012:log-group:/aws/lambda/*"]
        }
      ]
    },
  ]
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 100.0%