Skip to content
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

feat: support encoding_format #14663

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/7966.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
privateca: added support for encoding_format on CaPool
```
25 changes: 25 additions & 0 deletions google/resource_privateca_ca_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,14 @@ in all issued Certificates. If this is false, CRLs will not be published and the
be written in issued certificates. CRLs will expire 7 days from their creation. However, we will rebuild daily. CRLs are
also rebuilt shortly after a certificate is revoked.`,
},
"encoding_format": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: verify.ValidateEnum([]string{"PEM", "DER", ""}),
Description: `Specifies the encoding format of each CertificateAuthority's CA
certificate and CRLs. If this is omitted, CA certificates and CRLs
will be published in PEM. Possible values: ["PEM", "DER"]`,
},
},
},
},
Expand Down Expand Up @@ -1110,6 +1118,8 @@ func flattenPrivatecaCaPoolPublishingOptions(v interface{}, d *schema.ResourceDa
flattenPrivatecaCaPoolPublishingOptionsPublishCaCert(original["publishCaCert"], d, config)
transformed["publish_crl"] =
flattenPrivatecaCaPoolPublishingOptionsPublishCrl(original["publishCrl"], d, config)
transformed["encoding_format"] =
flattenPrivatecaCaPoolPublishingOptionsEncodingFormat(original["encodingFormat"], d, config)
return []interface{}{transformed}
}
func flattenPrivatecaCaPoolPublishingOptionsPublishCaCert(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
Expand All @@ -1120,6 +1130,10 @@ func flattenPrivatecaCaPoolPublishingOptionsPublishCrl(v interface{}, d *schema.
return v
}

func flattenPrivatecaCaPoolPublishingOptionsEncodingFormat(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}

func flattenPrivatecaCaPoolLabels(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
Expand Down Expand Up @@ -1472,6 +1486,13 @@ func expandPrivatecaCaPoolPublishingOptions(v interface{}, d tpgresource.Terrafo
transformed["publishCrl"] = transformedPublishCrl
}

transformedEncodingFormat, err := expandPrivatecaCaPoolPublishingOptionsEncodingFormat(original["encoding_format"], d, config)
if err != nil {
return nil, err
} else if val := reflect.ValueOf(transformedEncodingFormat); val.IsValid() && !tpgresource.IsEmptyValue(val) {
transformed["encodingFormat"] = transformedEncodingFormat
}

return transformed, nil
}

Expand All @@ -1483,6 +1504,10 @@ func expandPrivatecaCaPoolPublishingOptionsPublishCrl(v interface{}, d tpgresour
return v, nil
}

func expandPrivatecaCaPoolPublishingOptionsEncodingFormat(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandPrivatecaCaPoolLabels(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]string, error) {
if v == nil {
return map[string]string{}, nil
Expand Down
1 change: 1 addition & 0 deletions google/resource_privateca_ca_pool_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ resource "google_privateca_ca_pool" "default" {
publishing_options {
publish_ca_cert = false
publish_crl = true
encoding_format = "PEM"
}
labels = {
foo = "bar"
Expand Down
8 changes: 8 additions & 0 deletions website/docs/r/privateca_ca_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ resource "google_privateca_ca_pool" "default" {
publishing_options {
publish_ca_cert = false
publish_crl = true
encoding_format = "PEM"
}
labels = {
foo = "bar"
Expand Down Expand Up @@ -551,6 +552,13 @@ The following arguments are supported:
be written in issued certificates. CRLs will expire 7 days from their creation. However, we will rebuild daily. CRLs are
also rebuilt shortly after a certificate is revoked.

* `encoding_format` -
(Optional)
Specifies the encoding format of each CertificateAuthority's CA
certificate and CRLs. If this is omitted, CA certificates and CRLs
will be published in PEM.
Possible values are: `PEM`, `DER`.

## Attributes Reference

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