Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppAttest and PlayIntegrity for App Check #9970

Merged
merged 3 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Enhance examples to use precondition checks
  • Loading branch information
rainshen49 committed Feb 13, 2024
commit 3c30bda5c4e0868b5ee8eea84c8c6d85761c2d07
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
resource "google_firebase_apple_app" "default" {
project = "<%= ctx[:test_env_vars]['project_id'] %>"
project = "<%= ctx[:test_env_vars]['project_id'] %>"
display_name = "Apple app"
bundle_id = "<%= ctx[:vars]['bundle_id'] %>"
team_id = "<%= ctx[:vars]['team_id'] %>"
bundle_id = "<%= ctx[:vars]['bundle_id'] %>"
team_id = "<%= ctx[:vars]['team_id'] %>"
}

# It takes a while for App Check to recognize the new app
# If your app already exists, you don't have to wait 30 seconds.
resource "time_sleep" "wait_30s" {
depends_on = [google_firebase_apple_app.default]
depends_on = [google_firebase_apple_app.default]
create_duration = "30s"
}

resource "google_firebase_app_check_app_attest_config" "default" {
project = "<%= ctx[:test_env_vars]['project_id'] %>"
app_id = google_firebase_apple_app.default.app_id
project = "<%= ctx[:test_env_vars]['project_id'] %>"
app_id = google_firebase_apple_app.default.app_id
token_ttl = "<%= ctx[:vars]['token_ttl'] %>"

depends_on = [time_sleep.wait_30s]
}

lifecycle {
precondition {
condition = google_firebase_apple_app.default.team_id != ""
error_message = "Provide a Team ID on the Apple App to use App Check"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
resource "google_firebase_apple_app" "default" {
project = "<%= ctx[:test_env_vars]['project_id'] %>"
project = "<%= ctx[:test_env_vars]['project_id'] %>"
display_name = "Apple app"
bundle_id = "<%= ctx[:vars]['bundle_id'] %>"
team_id = "<%= ctx[:vars]['team_id'] %>"
bundle_id = "<%= ctx[:vars]['bundle_id'] %>"
team_id = "<%= ctx[:vars]['team_id'] %>"
}

# It takes a while for App Check to recognize the new app
# If your app already exists, you don't have to wait 30 seconds.
resource "time_sleep" "wait_30s" {
depends_on = [google_firebase_apple_app.default]
depends_on = [google_firebase_apple_app.default]
create_duration = "30s"
}

resource "google_firebase_app_check_app_attest_config" "default" {
project = "<%= ctx[:test_env_vars]['project_id'] %>"
app_id = google_firebase_apple_app.default.app_id
app_id = google_firebase_apple_app.default.app_id

depends_on = [time_sleep.wait_30s]
}

lifecycle {
precondition {
condition = google_firebase_apple_app.default.team_id != ""
error_message = "Provide a Team ID on the Apple App to use App Check"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ resource "time_sleep" "wait_30s" {
}

resource "google_firebase_app_check_play_integrity_config" "default" {
project = "<%= ctx[:test_env_vars]['project_id'] %>"
app_id = google_firebase_android_app.default.app_id
project = "<%= ctx[:test_env_vars]['project_id'] %>"
app_id = google_firebase_android_app.default.app_id
token_ttl = "<%= ctx[:vars]['token_ttl'] %>"

depends_on = [time_sleep.wait_30s]
}

lifecycle {
precondition {
condition = length(google_firebase_android_app.default.sha256_hashes) > 0
error_message = "Provide a SHA-256 certificate on the Android App to use App Check"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,11 @@ resource "google_firebase_app_check_play_integrity_config" "default" {
app_id = google_firebase_android_app.default.app_id

depends_on = [time_sleep.wait_30s]

lifecycle {
precondition {
condition = length(google_firebase_android_app.default.sha256_hashes) > 0
error_message = "Provide a SHA-256 certificate on the Android App to use App Check"
}
}
}
Loading