Skip to content

Commit

Permalink
Undo last commit (it was causing deployment timeouts)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaraphael committed Oct 17, 2023
1 parent 4184f96 commit 0965583
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cerulean_cloud/cloud_function_ais_analysis/utils/ais.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
)

credentials = Credentials.from_service_account_info(
json.loads(os.environ.get("GFW_CREDENTIALS"))
json.loads(os.environ.get("GOOGLE_APPLICATION_CREDENTIALS"))
)


Expand Down
21 changes: 13 additions & 8 deletions stack/cloud_function_ais_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@

import database
import pulumi
from pulumi_gcp import cloudfunctions, cloudtasks, projects, serviceaccount, storage
from pulumi_gcp import (
cloudfunctions,
cloudtasks,
projects,
secretmanager,
serviceaccount,
storage,
)
from utils import construct_name

stack = pulumi.get_stack()
Expand Down Expand Up @@ -34,6 +41,10 @@
),
)

service_account_secret = secretmanager.get_secret_version(
secret=pulumi.Config("ais").require("credentials")
)

function_name = construct_name("cloud-function-ais")
config_values = {
"DB_URL": database.sql_instance_url_with_asyncpg,
Expand All @@ -43,6 +54,7 @@
"FUNCTION_NAME": function_name,
"API_KEY": pulumi.Config("cerulean-cloud").require("apikey"),
"IS_DRY_RUN": pulumi.Config("cerulean-cloud").require("dryrun_ais"),
"GOOGLE_APPLICATION_CREDENTIALS": service_account_secret.secret_data,
}

# The Cloud Function source code itself needs to be zipped up into an
Expand Down Expand Up @@ -75,12 +87,6 @@
),
)

gfw_credentials = cloudfunctions.FunctionSecretEnvironmentVariableArgs(
key="GFW_CREDENTIALS",
secret=pulumi.Config("ais").require("credentials"),
version="latest",
)

fxn = cloudfunctions.Function(
function_name,
name=function_name,
Expand All @@ -93,7 +99,6 @@
trigger_http=True,
service_account_email=cloud_function_service_account.email,
available_memory_mb=512,
secret_environment_variables=[gfw_credentials],
)

invoker = cloudfunctions.FunctionIamMember(
Expand Down

0 comments on commit 0965583

Please sign in to comment.