35
loading...
This website collects cookies to deliver better user experience
resource "aws_s3_bucket" "data_logs" {
bucket = var.bucket_name
}
resource "aws_iam_role" "f_role" {
name = "f_role"
assume_role_policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "sts:AssumeRole",
"Principal": {
"Service": "firehose.amazonaws.com"
},
"Effect": "Allow",
"Sid": ""
}
]
}
EOF
}
Actions: define what action is allows over an AWS service.
Resources: define what resources actions can be performed.
Effect: define if the user or role is allowed or deny completing any actions on the resources. Deny is set by default, you would need to explicitly allow it.
resource "aws_iam_role_policy" "f_delivery_policy" {
role = aws_iam_role.f_role.id
policy = <<EOT
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:ListAllMyBuckets",
"s3:PutObject"
],
"Effect": "Allow",
"Resource": "${aws_s3_bucket.arn}"
},
{
"Action": [
"s3:*"
],
"Effect": "Allow",
"Resource": "${aws_s3_bucket.data_logs.arn}"
}
]
}
EOT
}
resource "aws_cloudwatch_dashboard" "thresholds_control" {
dashboard_name = "admin-dashboard"
dashboard_body = <<EOF
{
"widgets": [
{
"type": "metric",
"x": 0,
"y": 0,
"width": 12,
"height": 6,
"properties": {
"metrics": [
[
"AWS/EC2",
"CPUUtilization",
"InstanceId",
"i-012345"
]
],
"period": 300,
"stat": "Average",
"region": "us-east-1",
"title": "EC2 Instance CPU"
}
},
{
"type": "text",
"x": 0,
"y": 7,
"width": 3,
"height": 3,
"properties": {
"markdown": "We are monitoring"
}
}
]
}
EOF
}
dependency graph is a directed graph representing dependencies of several objects towards each other. It is possible to derive an evaluation order or the absence of an evaluation order that respects the given dependencies from the dependency graph.
wiki-Dependency_graph