Skip to content

Commit

Permalink
Merge pull request #1661 from api3dao/update-terraform
Browse files Browse the repository at this point in the history
Update Terraform and plugins
  • Loading branch information
amarthadan authored Mar 6, 2023
2 parents 5b7041e + 17a8559 commit 67b27dc
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .changeset/sharp-bikes-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.github/
**/node_modules/**
**/dist/**
!docker/scripts/dist
!docker/scripts/dist/**
**/build/**
**/coverage/**

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"docker:build:latest": "yarn docker:build:packaging && yarn docker:build:images:latest",
"docker:build:local": "yarn docker:build:packaging && yarn docker:build:images:local",
"docker:build:packaging": "yarn docker:scripts:build && docker build --tag api3/airnode-packaging:latest --file docker/Dockerfile .",
"docker:scripts:build": "ncc build docker/scripts/cli.ts -o docker/scripts/dist --no-cache --minify --source-map --transpile-only",
"docker:scripts:build": "ncc build docker/scripts/cli.ts -o docker/scripts/dist --no-cache --source-map --transpile-only",
"docker:scripts:docker:build": "docker run --rm -v /var/run/docker.sock:/var/run/docker.sock api3/airnode-packaging:latest docker build",
"docker:scripts:docker:build:latest": "yarn docker:scripts:docker:build",
"docker:scripts:docker:build:local": "yarn docker:scripts:docker:build --npm-registry local --npm-tag snapshot-local --docker-tags local",
Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-deployer/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG npmRegistryUrl=https://registry.npmjs.org/
ARG npmTag=latest

ENV name="airnode-deployer" \
baseTerraformURL="https://releases.hashicorp.com/terraform/1.2.3/terraform_1.2.3_linux_" \
baseTerraformURL="https://releases.hashicorp.com/terraform/1.3.9/terraform_1.3.9_linux_" \
appDir="/app"
ENV packageName="@api3/${name}"

Expand Down
2 changes: 1 addition & 1 deletion packages/airnode-deployer/terraform/aws/backend.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = "~> 1.2"
required_version = "~> 1.3"

backend "s3" {
key = "terraform.tfstate"
Expand Down
7 changes: 3 additions & 4 deletions packages/airnode-deployer/terraform/aws/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.71"
version = "~> 4.56"
}
}

required_version = "~> 1.2"
required_version = "~> 1.3"
}

provider "aws" {
profile = "default"
region = var.aws_region
region = var.aws_region
}
2 changes: 1 addition & 1 deletion packages/airnode-deployer/terraform/gcp/backend.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = "~> 1.2"
required_version = "~> 1.3"

backend "gcs" {
}
Expand Down
38 changes: 20 additions & 18 deletions packages/airnode-deployer/terraform/gcp/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,20 @@ module "run" {
module "startCoordinator" {
source = "./modules/function"

name = "${local.name_prefix}-startCoordinator"
entry_point = "startCoordinator"
source_dir = var.handler_dir
memory_size = 512
timeout = 65
configuration_file = var.configuration_file
secrets_file = var.secrets_file
region = var.gcp_region
project = var.gcp_project
schedule_interval = 1
max_instances = var.disable_concurrency_reservation ? null : 1
invoke_targets = [module.run.function_name]
name = "${local.name_prefix}-startCoordinator"
entry_point = "startCoordinator"
source_dir = var.handler_dir
memory_size = 512
timeout = 65
configuration_file = var.configuration_file
secrets_file = var.secrets_file
region = var.gcp_region
project = var.gcp_project
schedule_interval = 1
max_instances = var.disable_concurrency_reservation ? null : 1
invoke_targets = {
run = module.run.function_name
}
airnode_bucket = var.airnode_bucket
deployment_bucket_dir = var.deployment_bucket_dir
environment_variables = {
Expand Down Expand Up @@ -144,9 +146,9 @@ module "httpGw" {
}
project = var.gcp_project

invoke_targets = [
module.httpReq[0].function_name
]
invoke_targets = {
httpReq = module.httpReq[0].function_name
}

depends_on = [
google_project_service.apigateway_api,
Expand Down Expand Up @@ -194,9 +196,9 @@ module "httpSignedGw" {
}
project = var.gcp_project

invoke_targets = [
module.httpSignedReq[0].function_name
]
invoke_targets = {
httpSignedReq = module.httpSignedReq[0].function_name
}

depends_on = [
google_project_service.apigateway_api,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ resource "google_project_iam_member" "api_gateway_logging_writer_role" {
}

resource "google_cloudfunctions_function_iam_member" "invoker" {
for_each = toset(var.invoke_targets)
for_each = var.invoke_targets

cloud_function = each.key
cloud_function = each.value
role = "roles/cloudfunctions.invoker"
member = "serviceAccount:${google_service_account.api_gateway_service_account.email}"
project = var.project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ variable "template_variables" {

variable "invoke_targets" {
description = "Names of cloud functions that can be invoked from the APIGateway"
type = list(string)
default = []
type = map(string)
default = {}
}

variable "project" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ resource "google_project_iam_member" "function_logging_writer_role" {
}

resource "google_cloudfunctions_function_iam_member" "invoker" {
for_each = toset(var.invoke_targets)
for_each = var.invoke_targets

cloud_function = each.key
cloud_function = each.value
role = "roles/cloudfunctions.invoker"
member = "serviceAccount:${google_service_account.function_service_account.email}"
project = var.project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ variable "timeout" {

variable "invoke_targets" {
description = "Names of other cloud functions that can be invoked from the cloud function"
type = list(string)
default = []
type = map(string)
default = {}
}

variable "schedule_interval" {
Expand Down
4 changes: 2 additions & 2 deletions packages/airnode-deployer/terraform/gcp/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.7"
version = "~> 4.54"
}
}

required_version = "~> 1.2"
required_version = "~> 1.3"
}

provider "google" {
Expand Down

0 comments on commit 67b27dc

Please sign in to comment.