Skip to content

Commit

Permalink
Merge pull request #22 from ministryofjustice/tf12-upgrade-example
Browse files Browse the repository at this point in the history
Upgrade example and Readme to Terraform 0.12.13
  • Loading branch information
poornima-krishnasamy authored Nov 27, 2019
2 parents dc7de60 + 733fd58 commit 118ce90
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ From module version 3.2, this replaces the use of the `aws-s3-region`.**

```hcl
module "example_team_s3" {
source = "github.com/ministryofjustice/cloud-platform-terraform-s3-bucket"
source = "github.com/ministryofjustice/cloud-platform-terraform-s3-bucket?ref=4.0"
team_name = "example-repo"
acl = "public-read"
Expand All @@ -27,7 +27,7 @@ module "example_team_s3" {
# This is a new input.
providers = {
aws = "aws.london"
aws = aws.london
}
}
```
Expand Down
4 changes: 3 additions & 1 deletion example/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
terraform {
backend "s3" {}
backend "s3" {
}
}

provider "aws" {
Expand All @@ -17,3 +18,4 @@ provider "aws" {
alias = "ireland"
region = "eu-west-1"
}

26 changes: 13 additions & 13 deletions example/s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/
module "example_team_s3_bucket" {
source = "github.com/ministryofjustice/cloud-platform-terraform-s3-bucket?ref=3.3"
source = "github.com/ministryofjustice/cloud-platform-terraform-s3-bucket?ref=4.0"

team_name = "cloudplatform"
business-unit = "mojdigital"
Expand All @@ -16,10 +16,8 @@ module "example_team_s3_bucket" {

providers = {
# Can be either "aws.london" or "aws.ireland"
aws = "aws.london"
}

/*
aws = aws.london
/*
* The following example can be used if you need to define CORS rules for your s3 bucket.
* Follow the guidance here "https://www.terraform.io/docs/providers/aws/r/s3_bucket.html#using-cors"
*
Expand Down Expand Up @@ -80,13 +78,13 @@ module "example_team_s3_bucket" {
*/

/*
/*
* The following are exampls of bucket and user policies. They are treated as
* templates. Currently, the only available variable is `$${bucket_arn}`.
*
*/

/*
/*
* Allow a user (foobar) from another account (012345678901) to get objects from
* this bucket.
*
Expand All @@ -113,7 +111,7 @@ EOF
*/

/*
/*
* Override the default policy for the generated machine user of this bucket.
*
Expand Down Expand Up @@ -142,6 +140,7 @@ user_policy = <<EOF
EOF
*/
}
}

resource "kubernetes_secret" "example_team_s3_bucket" {
Expand All @@ -150,10 +149,11 @@ resource "kubernetes_secret" "example_team_s3_bucket" {
namespace = "my-namespace"
}

data {
access_key_id = "${module.example_team_s3_bucket.access_key_id}"
secret_access_key = "${module.example_team_s3_bucket.secret_access_key}"
bucket_arn = "${module.example_team_s3_bucket.bucket_arn}"
bucket_name = "${module.example_team_s3_bucket.bucket_name}"
data = {
access_key_id = module.example_team_s3_bucket.access_key_id
secret_access_key = module.example_team_s3_bucket.secret_access_key
bucket_arn = module.example_team_s3_bucket.bucket_arn
bucket_name = module.example_team_s3_bucket.bucket_name
}
}

4 changes: 4 additions & 0 deletions example/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

terraform {
required_version = ">= 0.12"
}

0 comments on commit 118ce90

Please sign in to comment.