Skip to content

Commit 88ed91a

Browse files
committed
Setup provider config
1 parent 5a4ce70 commit 88ed91a

File tree

7 files changed

+33
-13
lines changed

7 files changed

+33
-13
lines changed

static-site/acm.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ resource "aws_acm_certificate" "cloudfront_cert" {
22
domain_name = var.domain_name
33
validation_method = "DNS"
44
tags = var.tags
5-
provider = aws.useast1
5+
provider = aws.acm
66
}

static-site/cloudfront.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ resource "aws_cloudfront_distribution" "static_site" {
5151
error_caching_min_ttl = 0
5252
}
5353

54-
tags = var.tags
54+
tags = var.tags
55+
provider = aws.default
56+
5557
}
5658

5759
resource "aws_cloudfront_origin_access_control" "oac" {
@@ -60,6 +62,8 @@ resource "aws_cloudfront_origin_access_control" "oac" {
6062
origin_access_control_origin_type = "s3"
6163
signing_behavior = "always"
6264
signing_protocol = "sigv4"
65+
provider = aws.default
66+
6367
}
6468

6569
resource "aws_cloudfront_response_headers_policy" "cloudfront" {
@@ -87,4 +91,6 @@ resource "aws_cloudfront_response_headers_policy" "cloudfront" {
8791
override = true
8892
}
8993
}
94+
95+
provider = aws.default
9096
}

static-site/iam.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ resource "aws_iam_role" "deploy_web" {
77
name = var.role_name
88
assume_role_policy = data.aws_iam_policy_document.oidc.json
99
tags = var.tags
10+
provider = aws.default
1011
}
1112

1213
resource "aws_iam_policy" "deploy_web" {
13-
name = var.role_name
14-
policy = data.aws_iam_policy_document.deploy_web.json
15-
tags = var.tags
14+
name = var.role_name
15+
policy = data.aws_iam_policy_document.deploy_web.json
16+
tags = var.tags
17+
provider = aws.default
1618
}
1719

1820
resource "aws_iam_role_policy_attachment" "deploy_web" {
1921
role = aws_iam_role.deploy_web.name
2022
policy_arn = aws_iam_policy.deploy_web.arn
23+
provider = aws.default
2124
}

static-site/providers.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
provider "aws" {
2+
alias = "acm"
3+
}
4+
5+
provider "aws" {
6+
alias = "default"
7+
}

static-site/route53.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ resource "aws_route53_record" "static_site_a_record" {
1212
zone_id = aws_cloudfront_distribution.static_site.hosted_zone_id
1313
evaluate_target_health = false
1414
}
15+
16+
provider = aws.default
1517
}

static-site/s3.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ resource "aws_s3_bucket" "static_site" {
22
bucket = var.bucket_name
33
force_destroy = true
44
tags = var.tags
5+
provider = aws.default
56
}
67

78
resource "aws_s3_bucket_policy" "static_site_policy" {
8-
bucket = aws_s3_bucket.static_site.bucket
9-
policy = data.aws_iam_policy_document.static_site.json
9+
bucket = aws_s3_bucket.static_site.bucket
10+
policy = data.aws_iam_policy_document.static_site.json
11+
provider = aws.default
1012
}

static-site/variables.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ variable "minimum_protocol_version" {
2020
}
2121

2222
variable "role_name" {
23-
type = string
23+
type = string
2424
description = "The name of the role and policy with the ability to deploy"
25-
default = "deploy-static-site"
25+
default = "deploy-static-site"
2626
}
2727

2828
variable "restriction_type" {
29-
type = string
29+
type = string
3030
description = "The restriction type for the CloudFront distribution"
31-
default = "none"
31+
default = "none"
3232
}
3333

3434
variable "locations" {
35-
type = list(string)
35+
type = list(string)
3636
description = "The locations for the restriction type"
37-
default = []
37+
default = []
3838
}
3939

4040
variable "tags" {

0 commit comments

Comments
 (0)