added terrafrom configs

This commit is contained in:
2023-11-01 00:02:56 +02:00
parent a4f429eff9
commit f19e926b1a
21 changed files with 407 additions and 0 deletions

View 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
}
}

View 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]
}

View File

@@ -0,0 +1,4 @@
provider "aws" {
region = var.region
profile = "monit"
}

View File

@@ -0,0 +1,7 @@
variable "region" {
default = "eu-west-1"
}
variable "dev_account_id" {
default = "449091252457"
}