File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ resource "aws_iam_user" "new-user" {
2+ name = var. iam_user # Change the user name as needed
3+ }
4+
5+ resource "aws_iam_access_key" "my_access_key" {
6+ user = aws_iam_user. new-user . name
7+ }
8+
9+ output "access_key_id" {
10+ value = aws_iam_access_key. my_access_key . id
11+ }
12+
13+ output "secret_access_key" {
14+ value = aws_iam_access_key. my_access_key . secret
15+ sensitive = true # This will hide the secret in Terraform outputs
16+ }
Original file line number Diff line number Diff line change 1+ terraform {
2+ required_providers {
3+ aws = {
4+ source = " hashicorp/aws"
5+ version = " 5.72.1"
6+ }
7+ }
8+ }
9+
10+ provider "aws" {
11+ region = var. aws_region
12+ }
Original file line number Diff line number Diff line change 1+ variable "aws_region" {
2+ type = string
3+ default = " eu-central-1"
4+ description = " AWS region"
5+ }
6+
7+ variable "iam_user" {
8+ type = string
9+ default = " example"
10+ description = " name of the iam user created"
11+ }
You can’t perform that action at this time.
0 commit comments