Skip to content

Instantly share code, notes, and snippets.

View guivin's full-sized avatar

Guillaume Vincent guivin

View GitHub Profile
@guivin
guivin / providers.tf
Created August 21, 2021 10:55
terraform/modules/aws-ecs-wordpress/providers.tf
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.46.0"
}
random = {
source = "hashicorp/random"
version = "~> 3.1.0"
@guivin
guivin / outputs.tf
Created August 21, 2021 10:55
terraform/modules/aws-ecs-wordpress/outputs.tf
output "wordpress_admin_password" {
description = "The Wordpress admin password"
value = random_string.wordpress_admin_password.result
sensitive = true
}
@guivin
guivin / main.tf
Created August 21, 2021 10:54
terraform/modules/aws-ecs-wordpress/main.tf
resource "aws_iam_role" "ecs_task_execution_role" {
name = "ecs-execution-role"
assume_role_policy = <<EOF
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "",
"Effect": "Allow",
@guivin
guivin / locals.tf
Created August 21, 2021 10:53
terraform/modules/aws-ecs-wordpress/locals.tf
locals {
name = "${var.tags["environment"]}-${var.tags["project"]}"
}
@guivin
guivin / variables.tf
Created August 21, 2021 10:50
terraform/modules/aws-ecs/variables.tf
variable "tags" {
type = map(string)
description = "(Required) Tags for resources"
}
variable "region" {
type = string
description = "(Required) AWS region"
}
@guivin
guivin / variables.tf
Created August 21, 2021 10:48
terraform/modules/aws-ecs/variables.tf
variable "tags" {
type = map(string)
description = "(Required) Tags for resources"
}
variable "region" {
type = string
description = "(Required) AWS region"
}
@guivin
guivin / providers.tf
Created August 21, 2021 10:48
terraform/modules/aws-ecs/providers.tf
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.45.0"
}
}
}
provider "aws" {
@guivin
guivin / outputs.tf
Created August 21, 2021 10:47
terraform/modules/aws-ecs/outputs.tf
output "cluster_id" {
description = "The ECS cluster ID"
value = aws_ecs_cluster.default.id
}
output "cloudwatch_group_name" {
description = "The Cloudwatch group name to store container logs"
value = aws_cloudwatch_log_group.default.name
}
@guivin
guivin / main.tf
Created August 21, 2021 10:46
terraform/modules/aws-ecs/main.tf
resource "aws_ecs_cluster" "default" {
name = local.name
tags = merge({
name = local.name
}, var.tags)
}
resource "aws_cloudwatch_log_group" "default" {
name = local.name
tags = merge({
@guivin
guivin / locals.tf
Created August 21, 2021 10:46
terraform/modules/aws-ecs/locals.tf
locals {
name = "${var.tags["environment"]}-${var.tags["project"]}-ecs"
}