added terrafrom configs
This commit is contained in:
10
111111111111/iam/roles/data.tf
Normal file
10
111111111111/iam/roles/data.tf
Normal file
@@ -0,0 +1,10 @@
|
||||
data "template_file" "s3_policy" {
|
||||
template = file("../../templates/s3_bucker_access.tpl")
|
||||
}
|
||||
|
||||
data "template_file" "asume_role" {
|
||||
template = file("../../templates/assume_role.tpl")
|
||||
vars = {
|
||||
dev_account_id = var.dev_account_id
|
||||
}
|
||||
}
|
||||
24
111111111111/iam/roles/main.tf
Normal file
24
111111111111/iam/roles/main.tf
Normal file
@@ -0,0 +1,24 @@
|
||||
terraform {
|
||||
backend "s3" {
|
||||
profile = "terra"
|
||||
bucket = "mytesting-tf-states"
|
||||
key = "111111111111/iam/roles/terraform.tfstate"
|
||||
region = "eu-west-1"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
resource "aws_iam_policy" "s3_bucker_access_policy" {
|
||||
name = "s3_bucker_access_policy"
|
||||
path = "/"
|
||||
description = "s3_bucker_access_policy"
|
||||
|
||||
policy = data.template_file.s3_policy.rendered
|
||||
}
|
||||
|
||||
resource "aws_iam_role" "role_c" {
|
||||
name = "role_c"
|
||||
|
||||
assume_role_policy = data.template_file.asume_role.rendered
|
||||
managed_policy_arns = [aws_iam_policy.s3_bucker_access_policy.arn]
|
||||
}
|
||||
4
111111111111/iam/roles/provider.tf
Normal file
4
111111111111/iam/roles/provider.tf
Normal file
@@ -0,0 +1,4 @@
|
||||
provider "aws" {
|
||||
region = var.region
|
||||
profile = "monit"
|
||||
}
|
||||
7
111111111111/iam/roles/variables.tf
Normal file
7
111111111111/iam/roles/variables.tf
Normal file
@@ -0,0 +1,7 @@
|
||||
variable "region" {
|
||||
default = "eu-west-1"
|
||||
}
|
||||
|
||||
variable "dev_account_id" {
|
||||
default = "449091252457"
|
||||
}
|
||||
Reference in New Issue
Block a user