-
Notifications
You must be signed in to change notification settings - Fork 240
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
fix: provide a sensible example for a privateca Root CA example #631
Changes from all commits
bdda738
ee34cf8
572726a
f5acd83
2e01f3b
5b144c9
a0147de
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 |
---|---|---|
|
@@ -16,6 +16,8 @@ | |
|
||
# [START privateca_create_subordinateca] | ||
resource "google_privateca_certificate_authority" "root_ca" { | ||
// This example assumes this pool already exists. | ||
// Pools cannot be deleted in normal test circumstances, so we depend on static pools | ||
pool = "my-pool" | ||
certificate_authority_id = "my-certificate-authority-root" | ||
location = "us-central1" | ||
|
@@ -24,12 +26,9 @@ resource "google_privateca_certificate_authority" "root_ca" { | |
config { | ||
subject_config { | ||
subject { | ||
organization = "HashiCorp" | ||
organization = "ACME" | ||
common_name = "my-certificate-authority" | ||
} | ||
subject_alt_name { | ||
dns_names = ["hashicorp.com"] | ||
} | ||
} | ||
x509_config { | ||
ca_options { | ||
|
@@ -43,20 +42,21 @@ resource "google_privateca_certificate_authority" "root_ca" { | |
crl_sign = true | ||
} | ||
extended_key_usage { | ||
server_auth = false | ||
} | ||
} | ||
} | ||
} | ||
key_spec { | ||
algorithm = "RSA_PKCS1_4096_SHA256" | ||
} | ||
// valid for 10 years | ||
lifetime = "${10 * 365 * 24 * 3600}s" | ||
} | ||
|
||
resource "google_privateca_certificate_authority" "default" { | ||
resource "google_privateca_certificate_authority" "sub_ca" { | ||
// This example assumes this pool already exists. | ||
// Pools cannot be deleted in normal test circumstances, so we depend on static pools | ||
pool = "my-pool" | ||
pool = "my-sub-pool" | ||
glasnt marked this conversation as resolved.
Show resolved
Hide resolved
|
||
certificate_authority_id = "my-certificate-authority-sub" | ||
location = "us-central1" | ||
deletion_protection = false # set to true to prevent destruction of the resource | ||
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. (sorry for the misplaced comment -- I can't figure out how to comment on the actual lines I want to mention, which weren't modified here) Could you also make the following changes for the sub CA:
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. done, also took the freedom to replace HashiCorp with ACME 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. https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/products/privateca/CertificateAuthority.yaml#L404 there it's requiring the EKU block |
||
|
@@ -66,12 +66,9 @@ resource "google_privateca_certificate_authority" "default" { | |
config { | ||
subject_config { | ||
subject { | ||
organization = "HashiCorp" | ||
organization = "ACME" | ||
common_name = "my-subordinate-authority" | ||
} | ||
subject_alt_name { | ||
dns_names = ["hashicorp.com"] | ||
} | ||
} | ||
x509_config { | ||
ca_options { | ||
|
@@ -81,28 +78,18 @@ resource "google_privateca_certificate_authority" "default" { | |
} | ||
key_usage { | ||
base_key_usage { | ||
digital_signature = true | ||
content_commitment = true | ||
key_encipherment = false | ||
data_encipherment = true | ||
key_agreement = true | ||
cert_sign = true | ||
crl_sign = true | ||
decipher_only = true | ||
cert_sign = true | ||
crl_sign = true | ||
} | ||
extended_key_usage { | ||
server_auth = true | ||
client_auth = false | ||
email_protection = true | ||
code_signing = true | ||
time_stamping = true | ||
} | ||
} | ||
} | ||
} | ||
lifetime = "86400s" | ||
// valid for 5 years | ||
lifetime = "${5 * 365 * 24 * 3600}s" | ||
key_spec { | ||
algorithm = "RSA_PKCS1_4096_SHA256" | ||
algorithm = "RSA_PKCS1_2048_SHA256" | ||
} | ||
type = "SUBORDINATE" | ||
} | ||
|
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 you also remove the
extended_key_usage { .. }
block here as well?