-
Notifications
You must be signed in to change notification settings - Fork 58
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
Create KMS and service account resources for TUF-on-CI #944
Changes from 1 commit
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,40 @@ | ||||||
/** | ||||||
* Copyright 2023 The Sigstore Authors | ||||||
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.
Suggested change
|
||||||
* | ||||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
* you may not use this file except in compliance with the License. | ||||||
* You may obtain a copy of the License at | ||||||
* | ||||||
* http://www.apache.org/licenses/LICENSE-2.0 | ||||||
* | ||||||
* Unless required by applicable law or agreed to in writing, software | ||||||
* distributed under the License is distributed on an "AS IS" BASIS, | ||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
* See the License for the specific language governing permissions and | ||||||
* limitations under the License. | ||||||
*/ | ||||||
|
||||||
resource "google_kms_key_ring" "tuf-keyring" { | ||||||
name = var.tuf_keyring_name | ||||||
location = var.kms_location | ||||||
project = var.project_id | ||||||
} | ||||||
|
||||||
resource "google_kms_crypto_key" "tuf-key" { | ||||||
name = var.tuf_key_name | ||||||
key_ring = google_kms_key_ring.tuf-keyring.id | ||||||
purpose = "ASYMMETRIC_SIGN" | ||||||
version_template { | ||||||
algorithm = "EC_SIGN_P384_SHA384" | ||||||
protection_level = "SOFTWARE" | ||||||
} | ||||||
|
||||||
depends_on = [google_kms_key_ring.tuf-keyring] | ||||||
} | ||||||
|
||||||
resource "google_kms_key_ring_iam_member" "tuf-sa-key-iam" { | ||||||
key_ring_id = google_kms_key_ring.tuf-keyring.id | ||||||
role = "roles/cloudkms.signerVerifier" | ||||||
member = format("serviceAccount:%s@%s.iam.gserviceaccount.com", var.tuf_service_account_name, var.project_id) | ||||||
depends_on = [google_kms_key_ring.tuf-keyring, google_service_account.tuf-sa] | ||||||
} | ||||||
Comment on lines
+35
to
+40
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. this looks good to me. If you decide to remove the service account variable as suggested in other comment, member here would need changing to something like |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,21 @@ | ||||||
/** | ||||||
* Copyright 2023 The Sigstore Authors | ||||||
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.
Suggested change
|
||||||
* | ||||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
* you may not use this file except in compliance with the License. | ||||||
* You may obtain a copy of the License at | ||||||
* | ||||||
* http://www.apache.org/licenses/LICENSE-2.0 | ||||||
* | ||||||
* Unless required by applicable law or agreed to in writing, software | ||||||
* distributed under the License is distributed on an "AS IS" BASIS, | ||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||
* See the License for the specific language governing permissions and | ||||||
* limitations under the License. | ||||||
*/ | ||||||
|
||||||
resource "google_service_account" "tuf-sa" { | ||||||
account_id = var.tuf_service_account_name | ||||||
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. can we get rid of the variable and parametrize on cluster_name like rekor does: 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.
|
||||||
display_name = "TUF Service Account for GitHub Actions" | ||||||
project = var.project_id | ||||||
} |
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.
Could we simplify and not expose any of these as variables (except kms_location that seems potentially useful)?
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.
Given that there's defaults for these, most deployers won't have to think about setting the variables. My thought is that this is just in case someone is opinionated.