Skip to content

Commit be77a37

Browse files
committed
Terraform (and providers) up-to-date
1 parent 54ef686 commit be77a37

File tree

9 files changed

+99
-95
lines changed

9 files changed

+99
-95
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: lint
22

33
on:
44
push:
5-
branches: [main]
6-
pull_request:
7-
branches: [main]
85

96
jobs:
107
code:
@@ -13,7 +10,7 @@ jobs:
1310
- uses: actions/checkout@v3
1411
- uses: CodeForPoznan/actions/setup-infrastructure@v2
1512
with:
16-
terraform-version: 1.5.3
13+
terraform-version: 1.12.0
1714

1815
- run: make check
1916

.terraform.lock.hcl

Lines changed: 62 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,6 @@ Repository contains description of Code for Poznań infrastructure.
44
You'll need AWS credentials into our organization and a tunnel to our bastion server
55
in order to work with this code. This can't be done unless you've been added by one of admins (see ./admins.tf file).
66

7-
#### version used
8-
9-
```shell
10-
terraform version
11-
Terraform v1.5.2
12-
on darwin_arm64
13-
+ provider registry.terraform.io/cyrilgdn/postgresql v1.19.0
14-
+ provider registry.terraform.io/hashicorp/aws v5.7.0
15-
+ provider registry.terraform.io/hashicorp/cloudinit v2.3.2
16-
+ provider registry.terraform.io/hashicorp/random v3.5.1
17-
```
18-
19-
207
#### Initialize project
218

229
```

codeforpoznan_pl_v3.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ module "codeforpoznan_pl_v3_cloudfront_distribution" {
112112
origin_path = "/codeforpoznan_pl_v3"
113113
}
114114
api_gateway = {
115-
domain_name = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.codeforpoznan_pl_v3_serverless_api.deployment.invoke_url).hostname
116-
origin_path = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.codeforpoznan_pl_v3_serverless_api.deployment.invoke_url).path
115+
domain_name = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.codeforpoznan_pl_v3_serverless_api.stage.invoke_url).hostname
116+
origin_path = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.codeforpoznan_pl_v3_serverless_api.stage.invoke_url).path
117117
custom_origin = true
118118
}
119119
}
@@ -137,6 +137,11 @@ module "codeforpoznan_pl_v3_cloudfront_distribution" {
137137
]
138138
}
139139

140+
import {
141+
to = module.codeforpoznan_pl_v3_serverless_api.aws_api_gateway_stage.stage
142+
id = "q4ih7hkyl4/devel"
143+
}
144+
140145
module "codeforpoznan_pl_v3_serverless_api" {
141146
source = "./serverless_api"
142147

db.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ resource "aws_db_instance" "db" {
1616
identifier = "main-postgres"
1717

1818
engine = "postgres"
19-
engine_version = "12.17"
19+
engine_version = "12.19"
2020

2121
instance_class = "db.t3.micro"
2222
allocated_storage = 8

dev_codeforpoznan_pl_v3.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ resource "aws_iam_user_policy_attachment" "dev_codeforpoznan_pl_v3_ses_policy_at
113113
user = module.dev_codeforpoznan_pl_v3_user.user.name
114114
}
115115

116+
import {
117+
to = module.dev_codeforpoznan_pl_v3_serverless_api.aws_api_gateway_stage.stage
118+
id = "z00svsc3od/devel"
119+
}
120+
116121
module "dev_codeforpoznan_pl_v3_serverless_api" {
117122
source = "./serverless_api"
118123

@@ -153,8 +158,8 @@ module "dev_codeforpoznan_pl_v3_cloudfront_distribution" {
153158
origin_path = "/dev_codeforpoznan_pl_v3"
154159
}
155160
api_gateway = {
156-
domain_name = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.dev_codeforpoznan_pl_v3_serverless_api.deployment.invoke_url).hostname
157-
origin_path = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.dev_codeforpoznan_pl_v3_serverless_api.deployment.invoke_url).path
161+
domain_name = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.dev_codeforpoznan_pl_v3_serverless_api.stage.invoke_url).hostname
162+
origin_path = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.dev_codeforpoznan_pl_v3_serverless_api.stage.invoke_url).path
158163
custom_origin = true
159164
}
160165
}

dev_pah_fm.tf

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ module "dev_pah_fm_frontend_assets" {
6565
iam_user = module.dev_pah_fm_user.user
6666
}
6767

68+
import {
69+
to = module.dev_pah_fm_serverless_api.aws_api_gateway_stage.stage
70+
id = "8sbwf5qbi1/devel"
71+
}
72+
6873
module "dev_pah_fm_serverless_api" {
6974
source = "./serverless_api"
7075

@@ -112,8 +117,8 @@ module "dev_pah_fm_cloudfront_distribution" {
112117
origin_path = "/dev_pah_fm"
113118
}
114119
api_gateway = {
115-
domain_name = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.dev_pah_fm_serverless_api.deployment.invoke_url).hostname
116-
origin_path = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.dev_pah_fm_serverless_api.deployment.invoke_url).path
120+
domain_name = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.dev_pah_fm_serverless_api.stage.invoke_url).hostname
121+
origin_path = regex("https://(?P<hostname>[^/?#]*)(?P<path>[^?#]*)", module.dev_pah_fm_serverless_api.stage.invoke_url).path
117122
custom_origin = true
118123
}
119124
}

providers.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
terraform {
2-
required_version = ">= 1.5.0"
2+
required_version = "~> 1.12.0"
33

44
backend "s3" {
55
bucket = "codeforpoznan-tfstate"
@@ -11,20 +11,20 @@ terraform {
1111
required_providers {
1212
aws = {
1313
source = "hashicorp/aws"
14-
version = "5.61.0"
14+
version = "5.98.0"
1515
configuration_aliases = [aws.north_virginia]
1616
}
1717
random = {
1818
source = "hashicorp/random"
19-
version = "3.6.2"
19+
version = "3.7.2"
2020
}
2121
cloudinit = {
2222
source = "hashicorp/cloudinit"
23-
version = "2.3.4"
23+
version = "2.3.7"
2424
}
2525
postgresql = {
2626
source = "cyrilgdn/postgresql"
27-
version = "1.19.0"
27+
version = "1.25.0"
2828
}
2929
}
3030
}

serverless_api/main.tf

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,27 @@ resource "aws_api_gateway_integration" "proxy_integration" {
105105

106106
resource "aws_api_gateway_deployment" "deployment" {
107107
rest_api_id = aws_api_gateway_rest_api.rest_api.id
108-
stage_name = "devel"
109108

110109
depends_on = [
111110
aws_api_gateway_integration.root_integration,
112111
aws_api_gateway_integration.proxy_integration,
113112
]
114113
}
115114

115+
resource "aws_api_gateway_stage" "stage" {
116+
deployment_id = aws_api_gateway_deployment.deployment.id
117+
rest_api_id = aws_api_gateway_rest_api.rest_api.id
118+
stage_name = "devel"
119+
}
120+
116121
resource "aws_lambda_permission" "permission" {
117122
function_name = module.lambda.function.function_name
118123
statement_id = "${replace(title(replace(var.name, "/[\\._]/", " ")), " ", "")}Invoke"
119124
action = "lambda:InvokeFunction"
120125
principal = "apigateway.amazonaws.com"
121-
source_arn = "${replace(aws_api_gateway_deployment.deployment.execution_arn, "devel", "")}*/*"
126+
source_arn = "${replace(aws_api_gateway_stage.stage.execution_arn, "devel", "")}*/*"
122127
}
123128

124-
output "deployment" {
125-
value = aws_api_gateway_deployment.deployment
129+
output "stage" {
130+
value = aws_api_gateway_stage.stage
126131
}

0 commit comments

Comments
 (0)