-
Notifications
You must be signed in to change notification settings - Fork 0
feat(RHOAIENG-47026): add gcs resource #5
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # GCS bucket for ambient-code/pull-reviews public content. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # This bucket serves publicly-accessible artifacts generated by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # the pull-reviews GitHub Actions workflow. Objects are automatically | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # deleted after 45 days. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resource "google_storage_bucket" "pull_reviews" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| project = var.project_id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name = "ambient-code-pull-reviews" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a project-scoped bucket name to avoid global-name collisions. Line 9 uses a globally fixed GCS bucket name. Because bucket names are global (not project-scoped), this can break applies in other environments/projects and makes reuse brittle. Proposed fix resource "google_storage_bucket" "pull_reviews" {
project = var.project_id
- name = "ambient-code-pull-reviews"
+ name = "${var.project_id}-ambient-code-pull-reviews"
location = "US"As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity." 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @coderabbitai hard-coding works for simplicity. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| location = "US" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uniform_bucket_level_access = true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| lifecycle_rule { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| action { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type = "Delete" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| condition { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| age = 45 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+7
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider adding explicit dependency on the storage API. Without Proposed fix resource "google_storage_bucket" "pull_reviews" {
project = var.project_id
name = "ambient-code-pull-reviews"
location = "US"
uniform_bucket_level_access = true
lifecycle_rule {
action {
type = "Delete"
}
condition {
age = 45
}
}
+
+ depends_on = [google_project_service.storage]
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @coderabbitai why would it do that? We don't want to add explicit deps on everything in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The comment was already marked as a nitpick/trivial and was overly cautious. I'll drop it — no change needed here.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Allow anyone to read objects (public bucket). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resource "google_storage_bucket_iam_member" "pull_reviews_public_read" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bucket = google_storage_bucket.pull_reviews.name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| role = "roles/storage.objectViewer" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| member = "allUsers" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Allow the platform GitHub Actions workflow to upload objects. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # The platform repo runs the workflow that writes to this bucket, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # so the WIF principal must match that repo's OIDC token. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| resource "google_storage_bucket_iam_member" "pull_reviews_gha_write" { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bucket = google_storage_bucket.pull_reviews.name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| role = "roles/storage.objectCreator" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| member = "principalSet://iam.googleapis.com/${google_iam_workload_identity_pool.github_pool.name}/attribute.repository/ambient-code/platform" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part LGTM