test(module): really test the generated access key
Some checks failed
main / test (push) Failing after 4s

This commit is contained in:
Julien Dessaux 2025-04-26 00:31:19 +02:00
parent 00ee290f29
commit 7c4a6d85dd
Signed by: adyxax
GPG key ID: F92E51B86E07177E
5 changed files with 61 additions and 6 deletions

29
test/main.tf Normal file
View file

@ -0,0 +1,29 @@
data "aws_caller_identity" "current" {}
module "main" {
source = "../"
name = "tftest-user"
}
data "external" "main" {
program = ["${path.module}/test.sh"]
depends_on = [local_file.aws_config]
}
locals {
expected_arn = format(
"arn:aws:iam::%s:user/tftest-user",
data.aws_caller_identity.current.account_id,
)
}
resource "local_file" "aws_config" {
filename = "${path.module}/aws_config"
file_permission = "0600"
content = templatefile("${path.module}/aws_config.tftpl", {
aws_access_key_id = module.main.access_key_id
aws_access_key_secret = module.main.access_key_secret
})
}