diff --git a/infrastructure/tofu/main.tf b/infrastructure/tofu/main.tf index 6180f21..2a3aea4 100644 --- a/infrastructure/tofu/main.tf +++ b/infrastructure/tofu/main.tf @@ -11,28 +11,12 @@ module "aws_iam_ci_user" { source = "git::ssh://git@git.adyxax.org/adyxax/tofu-module-aws-iam-ci-user?depth=1&ref=1.0.1" name = local.name -} - -resource "aws_iam_policy" "tftest" { - provider = aws.all["root"] - - name = "${local.name}-tftest" - policy = jsonencode({ - Statement = [{ - Action = "iam:*" - Effect = "Allow" - Resource = [ - "arn:aws:iam::*:user/tftest-user", - "arn:aws:iam::*:policy/${local.name}-tftest", - ] - }] - Version = "2012-10-17" - }) -} - -resource "aws_iam_user_policy_attachment" "tftest" { - provider = aws.all["root"] - - policy_arn = aws_iam_policy.tftest.arn - user = local.name + tests_policy_statements = jsonencode([{ + Action = "iam:*" + Effect = "Allow" + Resource = [ + "arn:aws:iam::*:user/tftest-user", + "arn:aws:iam::*:policy/${local.name}-tftest", + ] + }]) } diff --git a/main.tftest.hcl b/main.tftest.hcl index 1662cf6..f5e0950 100644 --- a/main.tftest.hcl +++ b/main.tftest.hcl @@ -1,5 +1,5 @@ provider "aws" { - profile = "root" + profile = "tests" region = "eu-west-3" }