https://docs.aws.amazon.com/ko_kr/cli/latest/userguide/getting-started-install.html
set AWS_PROFILE=
aws configure # 계정등록
provider "aws" {
region = "ap-northeast-2"
}
resource "aws_iam_user" "devloper1" {
name = "devloper1"
path = "/system/"
}
provider "aws" {
region = "ap-northeast-2"
}
aws 이용 및 리젼 서울로
resource "aws_iam_user" "devloper1" {
name = "devloper1"
path = "/system/"
}
path는 네임 스페이스 역할
/system/ 경로는 시스템 관련 리소스를 그룹화하는 데 사용할 수 있습니다.
resource "aws_iam_policy" "policy" {
name = "test_policy"
path = "/system/"
description = "My test policy"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = [
"iam:*"
]
Effect = "Allow"
Resource = "*"
},
]
})
}
resource "aws_iam_user_policy_attachment" "developer1_policy_attachment" {
user = aws_iam_user.devloper1.name
policy_arn = aws_iam_policy.policy.arn
}
정책 생성
resource "aws_iam_policy" "policy" {
name = "test_policy"
path = "/system/"
description = "My test policy"
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Action = [
"iam:*"
]
Effect = "Allow"
Resource = "*"
},
]
})
}
"iam:" iam 관련 모든 api 정책 수용
Effect = "Allow" 허용한다
Resource = "" 모든 iam 리소스에 대해
user = aws_iam_user.devloper1.name
policy_arn = aws_iam_policy.policy.arn
}