fleet/tools/terraform/main.tf
Benjamin Edwards 0fb6416d45
Add Cloudwatch monitoring to AWS Terraform configs (#2485)
* add support for minio backend file carving
* add changes file
* rds alarm and sns topic
* added cloudwatch alarm documenation
* Update docs/01-Using-Fleet/06-Monitoring-Fleet.md
* update aws provider version to fix bug in ecs container insights, add more redis alerts
Co-authored-by: Zach Wasserman <zach@fleetdm.com>
2021-10-22 15:38:00 -04:00

60 lines
1.2 KiB
HCL

variable "region" {
default = "us-east-2"
}
provider "aws" {
region = var.region
}
terraform {
// these values are hard-coded to prevent chicken before the egg situations
backend "s3" {
bucket = "fleet-terraform-remote-state"
region = "us-east-2"
key = "fleet/"
dynamodb_table = "fleet-terraform-state-lock"
}
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.57.0"
}
}
}
data "aws_caller_identity" "current" {}
resource "aws_s3_bucket" "remote_state" {
bucket = "${var.prefix}-terraform-remote-state"
acl = "private"
versioning {
enabled = true
}
lifecycle {
prevent_destroy = true
}
tags = {
Name = "S3 Remote Terraform State Store"
}
}
resource "aws_s3_bucket_public_access_block" "fleet_terraform_state" {
bucket = aws_s3_bucket.remote_state.id
block_public_acls = true
block_public_policy = true
}
resource "aws_dynamodb_table" "fleet_terraform_state_lock" {
name = "fleet-terraform-state-lock"
hash_key = "LockID"
billing_mode = "PAY_PER_REQUEST"
attribute {
name = "LockID"
type = "S"
}
tags = {
Name = "DynamoDB Terraform State Lock Table"
}
}