Skip to content

Commit

Permalink
Fix subordinate CA creation with max_issuer_path_legth = 0 (#5107) (#…
Browse files Browse the repository at this point in the history
…9856)

* fix max_issuer_path_legth = 0 issue

* fix maxIssuerPathLength for pools too

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Aug 19, 2021
1 parent b3202d4 commit 4f10f86
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/5107.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
privateca: fixed the creation of subordinate `google_privateca_certificate_authority` with `max_issuer_path_length = 0`.
```
2 changes: 1 addition & 1 deletion google/resource_privateca_ca_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ func expandPrivatecaCaPoolIssuancePolicyBaselineValuesCaOptions(v interface{}, d
transformedMaxIssuerPathLength, err := expandPrivatecaCaPoolIssuancePolicyBaselineValuesCaOptionsMaxIssuerPathLength(original["max_issuer_path_length"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedMaxIssuerPathLength); val.IsValid() && !isEmptyValue(val) {
} else {
transformed["maxIssuerPathLength"] = transformedMaxIssuerPathLength
}

Expand Down
2 changes: 1 addition & 1 deletion google/resource_privateca_certificate_authority.go
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ func expandPrivatecaCertificateAuthorityConfigX509ConfigCaOptions(v interface{},
transformedMaxIssuerPathLength, err := expandPrivatecaCertificateAuthorityConfigX509ConfigCaOptionsMaxIssuerPathLength(original["max_issuer_path_length"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedMaxIssuerPathLength); val.IsValid() && !isEmptyValue(val) {
} else {
transformed["maxIssuerPathLength"] = transformedMaxIssuerPathLength
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ resource "google_privateca_certificate_authority" "default" {
x509_config {
ca_options {
is_ca = true
max_issuer_path_length = 10
# Force the sub CA to only issue leaf certs
max_issuer_path_length = 0
}
key_usage {
base_key_usage {
Expand Down
3 changes: 2 additions & 1 deletion website/docs/r/privateca_certificate_authority.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ resource "google_privateca_certificate_authority" "default" {
x509_config {
ca_options {
is_ca = true
max_issuer_path_length = 10
# Force the sub CA to only issue leaf certs
max_issuer_path_length = 0
}
key_usage {
base_key_usage {
Expand Down

0 comments on commit 4f10f86

Please sign in to comment.