From 8f8fc1fecc97855fb2df2d6b1888df6049039362 Mon Sep 17 00:00:00 2001 From: Lantrix Date: Mon, 19 Sep 2022 02:15:05 +1000 Subject: [PATCH 1/2] Update AWS provider Change from terraform 0.13 and onwards --- Terraform/providers.tf | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Terraform/providers.tf b/Terraform/providers.tf index 4518767..a1a0b8c 100644 --- a/Terraform/providers.tf +++ b/Terraform/providers.tf @@ -1,6 +1,13 @@ +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 4.0" + } + } +} provider "aws" { - region = var.region - shared_credentials_file = var.shared_credentials_file - profile = var.profile + region = var.region + shared_credentials_files = [var.shared_credentials_file] + profile = var.profile } - From d250fa15164cd37056f53ed8173275a48530546e Mon Sep 17 00:00:00 2001 From: Lantrix Date: Mon, 19 Sep 2022 02:26:40 +1000 Subject: [PATCH 2/2] Readme to note 0.13 changes --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 04de635..d64f1cf 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,19 @@ The static website is published on a subdomain registered in Route 53. > A live example can be found at [https://serverless-static-website-with-basic-auth.dumrauf.uk/](https://serverless-static-website-with-basic-auth.dumrauf.uk/?utm_source=GitHub&utm_medium=social&utm_campaign=README) using the demo username `guest` and password [`letmein`](https://www.theguardian.com/technology/2016/jan/20/123456-worst-passwords-revealed). > Note that access to the underlying [S3 bucket](https://us-east-1-serverless-webs-serverlesswebsitebucket-1mtsv4odbs2x0.s3.amazonaws.com) hosting the static website is denied. -The master branch in this repository is compliant with [Terraform v0.12](https://www.terraform.io/upgrade-guides/0-12.html); a legacy version that is compatible with [Terraform v0.11](https://www.terraform.io/upgrade-guides/0-11.html) is available on branch [terraform@0.11](https://github.com/dumrauf/serverless_static_website_with_basic_auth/tree/terraform%400.11). +The master branch in this repository is compliant with [Terraform >= v0.13](https://www.terraform.io/language/v1.1.x/upgrade-guides/0-13); a legacy version that is compatible with [Terraform v0.11](https://www.terraform.io/upgrade-guides/0-11.html) is available on branch [terraform@0.11](https://github.com/dumrauf/serverless_static_website_with_basic_auth/tree/terraform%400.11). + +> **Note** +> Upgrading from `v0.12` to later versions + +Due to changes in the AWS provider, if you have existing state from <= `v0.12` and are upgrading to >= `v0.13` the following will achieve that: + +```shell +terraform state replace-provider -- -/random hashicorp/random +terraform state replace-provider -- -/archive hashicorp/archive +terraform state replace-provider -- -/aws hashicorp/aws +terraform init +``` ## You Have