Skip to content

Instantly share code, notes, and snippets.

View tcondeixa's full-sized avatar
:octocat:

Tiago Condeixa tcondeixa

:octocat:
View GitHub Profile

Keybase proof

I hereby claim:

  • I am tcondeixa on github.
  • I am tcondeixa (https://keybase.io/tcondeixa) on keybase.
  • I have a public key ASAeYvxDBB8gHD4uHXTJ_dYRNlobmWl3a0HNrfjLb79GmAo

To claim this, I am signing this object:

@tcondeixa
tcondeixa / s3_bucket_setup-outputs.tf
Created October 10, 2019 12:52
Terraform Composed Module AWS S3 Bucket Setup - Outputs
output "s3_bucket" {
description = "map with arn, name and id of the s3 bucket example s3_bucket[\"arn\"]"
value = module.s3.s3_bucket
}
@tcondeixa
tcondeixa / s3_bucket_setup-variables.tf
Created October 10, 2019 12:50
Terraform Composed Module AWS S3 Bucket Setup - Variables
variable "aws_region" {
description = "aws region to be used"
type = string
}
variable "environment" {
description = "environment to associate example dev, staging, production"
type = string
}
@tcondeixa
tcondeixa / s3_bucket-outputs.tf
Last active October 10, 2019 12:42
Terraform Basic Module AWS S3 Bucket - Outputs
output "s3_bucket" {
description = "map with arn, name and id of the s3 bucket example s3_bucket[\"arn\"]"
value = map (
"arn", var.create ? aws_s3_bucket.bucket[0].arn : null,
"name", var.create ? aws_s3_bucket.bucket[0].bucket : null,
"id", var.create ? aws_s3_bucket.bucket[0].id : null
)
}
@tcondeixa
tcondeixa / s3_bucket-variables.tf
Created October 10, 2019 12:35
Terraform Basic Module AWS S3 Bucket - Variables
variable "aws_region" {
description = "region to create the bucket"
type = string
}
variable "name" {
description = "name of the bucket before appending other things"
type = string
}
@tcondeixa
tcondeixa / s3_bucket-main.tf
Last active May 18, 2020 09:54
Terraform Basic Module AWS S3 Bucket - Main
locals {
encryption_alg = var.rest_encryption ? [{sse_algorithm: "AES256"}] : []
replication = var.backup_replication ? [{status: "Enabled"}] : []
expiration_days = var.expiration_days != 0 ? [{days: var.expiration_days}] : []
noncurrent_version_expiration = var.expiration_versioning_days != 0 ? [{days: var.expiration_versioning_days}] : []
cors_rule = var.cors_enable ? [var.cors_rule] : []
website = var.website_enable ? [var.website] : []
}
resource "aws_s3_bucket" "bucket" {
@tcondeixa
tcondeixa / s3_bucket_setup-main.tf
Last active October 10, 2019 12:42
Terraform Composed Module AWS S3 Bucket Setup - Main
module "s3" {
source = "../../../../basic_modules/aws/s3_bucket/v1"
create = true
aws_region = var.aws_region
environment = var.environment
namespace = var.namespace
name = "${var.environment}-${var.namespace}-${var.name}-${var.aws_region}${var.domain}"
folders = var.folders

Keybase proof

I hereby claim:

  • I am tcondeixa on github.
  • I am tcondeixa (https://keybase.io/tcondeixa) on keybase.
  • I have a public key ASD5A9fZIRulHGl6nxnPD2YXJlNYW3biK0yqbrMhc_indAo

To claim this, I am signing this object: