From 8e5600bdd941ffb7ba49cfcefac76c29bc2825a6 Mon Sep 17 00:00:00 2001 From: jjcallis Date: Mon, 27 Mar 2023 13:25:22 +0100 Subject: [PATCH] upgrade terraform, aws provider and provide example --- example/data_aws_caller_identity.tf | 5 +++++ example/module_cloudfront_example.tf | 9 +++++++++ example/provider.tf | 3 +++ example/terraform.tfvars | 6 ++++++ example/variables.tf | 11 +++++++++++ terraform.tf | 9 +++++++-- 6 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 example/data_aws_caller_identity.tf create mode 100644 example/module_cloudfront_example.tf create mode 100644 example/provider.tf create mode 100644 example/terraform.tfvars create mode 100644 example/variables.tf diff --git a/example/data_aws_caller_identity.tf b/example/data_aws_caller_identity.tf new file mode 100644 index 0000000..8a9f89d --- /dev/null +++ b/example/data_aws_caller_identity.tf @@ -0,0 +1,5 @@ +data "aws_region" "current" {} +data "aws_availability_zones" "this" {} +data "aws_caller_identity" "current" {} +data "aws_iam_account_alias" "current" {} + diff --git a/example/module_cloudfront_example.tf b/example/module_cloudfront_example.tf new file mode 100644 index 0000000..d4a400e --- /dev/null +++ b/example/module_cloudfront_example.tf @@ -0,0 +1,9 @@ +module "cloudfront_example" { + source = "git::ssh://git@github.com/osodevops/aws-terraform-module-cloudfront-s3.git" + s3_source_bukcet_name = local.example_bucket_name + distribution_fqdn = "example.domain-name.com" + distribution_name = "example" + hosted_zone_name = "domain-name.com" + common_tags = var.common_tags + cloudfront_cache_compress_content = var.cloudfront_cache_compress_content +} \ No newline at end of file diff --git a/example/provider.tf b/example/provider.tf new file mode 100644 index 0000000..5e8b729 --- /dev/null +++ b/example/provider.tf @@ -0,0 +1,3 @@ +provider "aws" { + region = "eu-west-2" +} \ No newline at end of file diff --git a/example/terraform.tfvars b/example/terraform.tfvars new file mode 100644 index 0000000..4a33e8f --- /dev/null +++ b/example/terraform.tfvars @@ -0,0 +1,6 @@ +common_tags = { + Environment = "STAG" + CostCode = "S3" + TF_State = "s3_bucket" + Tool = "Terraform" +} \ No newline at end of file diff --git a/example/variables.tf b/example/variables.tf new file mode 100644 index 0000000..da18162 --- /dev/null +++ b/example/variables.tf @@ -0,0 +1,11 @@ +variable "common_tags" { + type = map(string) +} + +variable "cloudfront_cache_compress_content" { + type = bool + default = true +} +locals { + example_bucket_name = "example-${data.aws_region.current.name}-${lower(data.aws_iam_account_alias.current.account_alias)}" +} \ No newline at end of file diff --git a/terraform.tf b/terraform.tf index 106ecff..3b1e9f5 100644 --- a/terraform.tf +++ b/terraform.tf @@ -1,3 +1,8 @@ terraform { - required_version = ">= 0.13.5" -} + required_providers { + aws = { + source = "hashicorp/aws" + version = "4.60.0" + } + } +} \ No newline at end of file