Skip to content

Commit 8297465

Browse files
feat: support encoding_format (#7966) (#14663)
* feat: support encodingFormat * Update mmv1/products/privateca/CaPool.yaml --------- Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
1 parent bbcd741 commit 8297465

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

.changelog/7966.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
privateca: added support for encoding_format on CaPool
3+
```

google/resource_privateca_ca_pool.go

+25
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,14 @@ in all issued Certificates. If this is false, CRLs will not be published and the
573573
be written in issued certificates. CRLs will expire 7 days from their creation. However, we will rebuild daily. CRLs are
574574
also rebuilt shortly after a certificate is revoked.`,
575575
},
576+
"encoding_format": {
577+
Type: schema.TypeString,
578+
Optional: true,
579+
ValidateFunc: verify.ValidateEnum([]string{"PEM", "DER", ""}),
580+
Description: `Specifies the encoding format of each CertificateAuthority's CA
581+
certificate and CRLs. If this is omitted, CA certificates and CRLs
582+
will be published in PEM. Possible values: ["PEM", "DER"]`,
583+
},
576584
},
577585
},
578586
},
@@ -1110,6 +1118,8 @@ func flattenPrivatecaCaPoolPublishingOptions(v interface{}, d *schema.ResourceDa
11101118
flattenPrivatecaCaPoolPublishingOptionsPublishCaCert(original["publishCaCert"], d, config)
11111119
transformed["publish_crl"] =
11121120
flattenPrivatecaCaPoolPublishingOptionsPublishCrl(original["publishCrl"], d, config)
1121+
transformed["encoding_format"] =
1122+
flattenPrivatecaCaPoolPublishingOptionsEncodingFormat(original["encodingFormat"], d, config)
11131123
return []interface{}{transformed}
11141124
}
11151125
func flattenPrivatecaCaPoolPublishingOptionsPublishCaCert(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
@@ -1120,6 +1130,10 @@ func flattenPrivatecaCaPoolPublishingOptionsPublishCrl(v interface{}, d *schema.
11201130
return v
11211131
}
11221132

1133+
func flattenPrivatecaCaPoolPublishingOptionsEncodingFormat(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
1134+
return v
1135+
}
1136+
11231137
func flattenPrivatecaCaPoolLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
11241138
return v
11251139
}
@@ -1472,6 +1486,13 @@ func expandPrivatecaCaPoolPublishingOptions(v interface{}, d tpgresource.Terrafo
14721486
transformed["publishCrl"] = transformedPublishCrl
14731487
}
14741488

1489+
transformedEncodingFormat, err := expandPrivatecaCaPoolPublishingOptionsEncodingFormat(original["encoding_format"], d, config)
1490+
if err != nil {
1491+
return nil, err
1492+
} else if val := reflect.ValueOf(transformedEncodingFormat); val.IsValid() && !tpgresource.IsEmptyValue(val) {
1493+
transformed["encodingFormat"] = transformedEncodingFormat
1494+
}
1495+
14751496
return transformed, nil
14761497
}
14771498

@@ -1483,6 +1504,10 @@ func expandPrivatecaCaPoolPublishingOptionsPublishCrl(v interface{}, d tpgresour
14831504
return v, nil
14841505
}
14851506

1507+
func expandPrivatecaCaPoolPublishingOptionsEncodingFormat(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
1508+
return v, nil
1509+
}
1510+
14861511
func expandPrivatecaCaPoolLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
14871512
if v == nil {
14881513
return map[string]string{}, nil

google/resource_privateca_ca_pool_generated_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ resource "google_privateca_ca_pool" "default" {
103103
publishing_options {
104104
publish_ca_cert = false
105105
publish_crl = true
106+
encoding_format = "PEM"
106107
}
107108
labels = {
108109
foo = "bar"

website/docs/r/privateca_ca_pool.html.markdown

+8
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ resource "google_privateca_ca_pool" "default" {
6363
publishing_options {
6464
publish_ca_cert = false
6565
publish_crl = true
66+
encoding_format = "PEM"
6667
}
6768
labels = {
6869
foo = "bar"
@@ -551,6 +552,13 @@ The following arguments are supported:
551552
be written in issued certificates. CRLs will expire 7 days from their creation. However, we will rebuild daily. CRLs are
552553
also rebuilt shortly after a certificate is revoked.
553554

555+
* `encoding_format` -
556+
(Optional)
557+
Specifies the encoding format of each CertificateAuthority's CA
558+
certificate and CRLs. If this is omitted, CA certificates and CRLs
559+
will be published in PEM.
560+
Possible values are: `PEM`, `DER`.
561+
554562
## Attributes Reference
555563

556564
In addition to the arguments listed above, the following computed attributes are exported:

0 commit comments

Comments
 (0)