diff --git a/mmv1/products/privateca/CertificateTemplate.yaml b/mmv1/products/privateca/CertificateTemplate.yaml index 71ebf28c52e4..464e8cf6a735 100644 --- a/mmv1/products/privateca/CertificateTemplate.yaml +++ b/mmv1/products/privateca/CertificateTemplate.yaml @@ -1,5 +1,5 @@ # Copyright 2023 Google Inc. -# Licensed under the Apache License, Version 2.0 (the "License"); +# 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 # @@ -12,14 +12,38 @@ # limitations under the License. --- !ruby/object:Api::Resource -name: 'CertificateTemplate' +name: CertificateTemplate base_url: projects/{{project}}/locations/{{location}}/certificateTemplates +create_url: projects/{{project}}/locations/{{location}}/certificateTemplates?certificateTemplateId={{name}} self_link: projects/{{project}}/locations/{{location}}/certificateTemplates/{{name}} -# This resource is only used to generate IAM resources. They do not correspond to real -# GCP resources, and should not be used to generate anything other than IAM support. -exclude_resource: true +update_verb: :PATCH +update_mask: true +references: !ruby/object:Api::Resource::ReferenceLinks + guides: + 'Official Documentation': 'https://cloud.google.com/certificate-authority-service' + 'Understanding Certificate Templates': 'https://cloud.google.com/certificate-authority-service/docs/certificate-template' + 'Common configurations and Certificate Profiles': 'https://cloud.google.com/certificate-authority-service/docs/certificate-profile' + api: 'https://cloud.google.com/certificate-authority-service/docs/reference/rest' +async: !ruby/object:Api::OpAsync + operation: !ruby/object:Api::OpAsync::Operation + base_url: '{{op_id}}' + path: 'name' + wait_ms: 1000 + result: !ruby/object:Api::OpAsync::Result + path: 'response' + resource_inside_response: true + status: !ruby/object:Api::OpAsync::Status + path: 'done' + complete: true + allowed: + - true + - false + error: !ruby/object:Api::OpAsync::Error + path: 'error' + message: 'message' description: | - Only used to generate IAM resources + Certificate Authority Service provides reusable and parameterized templates that you can use for common certificate issuance scenarios. A certificate template represents a relatively static and well-defined certificate issuance schema within an organization. A certificate template can essentially become a full-fledged vertical certificate issuance framework. +legacy_long_form_project: true iam_policy: !ruby/object:Api::Resource::IamPolicy allowed_iam_role: 'roles/privateca.templateUser' method_name_separator: ':' @@ -37,6 +61,238 @@ examples: name: 'my-template' properties: - !ruby/object:Api::Type::String - name: 'name' - description: Dummy property. + name: name + description: The resource name for this CertificateTemplate in the format `projects/*/locations/*/certificateTemplates/*`. required: true + immutable: true + url_param_only: true + - !ruby/object:Api::Type::String + name: location + description: The location for the resource + url_param_only: true + required: true + immutable: true + - !ruby/object:Api::Type::NestedObject + name: predefinedValues + description: Optional. A set of X.509 values that will be applied to all issued certificates that use this template. If the certificate request includes conflicting values for the same properties, they will be overwritten by the values defined here. If the issuing CaPool's IssuancePolicy defines conflicting baseline_values for the same properties, the certificate issuance request will fail. + properties: + - !ruby/object:Api::Type::NestedObject + name: keyUsage + description: Optional. Indicates the intended use for keys that correspond to a certificate. + properties: + - !ruby/object:Api::Type::NestedObject + name: baseKeyUsage + description: Describes high-level ways in which a key may be used. + diff_suppress_func: 'tpgresource.EmptyOrUnsetBlockDiffSuppress' + properties: + - !ruby/object:Api::Type::Boolean + name: digitalSignature + description: The key may be used for digital signatures. + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: contentCommitment + description: The key may be used for cryptographic commitments. Note that this may also be referred to as "non-repudiation". + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: keyEncipherment + description: The key may be used to encipher other keys. + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: dataEncipherment + description: The key may be used to encipher data. + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: keyAgreement + description: The key may be used in a key agreement protocol. + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: certSign + description: The key may be used to sign certificates. + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: crlSign + description: The key may be used sign certificate revocation lists. + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: encipherOnly + description: The key may be used to encipher only. + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: decipherOnly + description: The key may be used to decipher only. + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::NestedObject + name: extendedKeyUsage + description: Detailed scenarios in which a key may be used. + diff_suppress_func: 'tpgresource.EmptyOrUnsetBlockDiffSuppress' + properties: + - !ruby/object:Api::Type::Boolean + name: serverAuth + description: Corresponds to OID 1.3.6.1.5.5.7.3.1. Officially described as "TLS WWW server authentication", though regularly used for non-WWW TLS. + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: clientAuth + description: Corresponds to OID 1.3.6.1.5.5.7.3.2. Officially described as "TLS WWW client authentication", though regularly used for non-WWW TLS. + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: codeSigning + description: Corresponds to OID 1.3.6.1.5.5.7.3.3. Officially described as "Signing of downloadable executable code client authentication". + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: emailProtection + description: Corresponds to OID 1.3.6.1.5.5.7.3.4. Officially described as "Email protection". + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: timeStamping + description: Corresponds to OID 1.3.6.1.5.5.7.3.8. Officially described as "Binding the hash of an object to a time". + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Boolean + name: ocspSigning + description: Corresponds to OID 1.3.6.1.5.5.7.3.9. Officially described as "Signing OCSP responses". + send_empty_value: true + diff_suppress_func: 'tpgresource.EmptyOrFalseSuppressBoolean' + - !ruby/object:Api::Type::Array + name: unknownExtendedKeyUsages + description: Used to describe extended key usages that are not listed in the KeyUsage.ExtendedKeyUsageOptions message. + item_type: !ruby/object:Api::Type::NestedObject + name: unknownExtendedKeyUsage + description: Used to describe extended key usages that are not listed in the KeyUsage.ExtendedKeyUsageOptions message. + properties: + - !ruby/object:Api::Type::Array + name: objectIdPath + description: Required. The parts of an OID path. The most significant parts of the path come first. + required: true + item_type: Api::Type::Integer + - !ruby/object:Api::Type::NestedObject + name: caOptions + description: Optional. Describes options in this X509Parameters that are relevant in a CA certificate. + properties: + - !ruby/object:Api::Type::Boolean + name: isCa + description: Optional. Refers to the "CA" X.509 extension, which is a boolean value. When this value is missing, the extension will be omitted from the CA certificate. + send_empty_value: true + - !ruby/object:Api::Type::Integer + name: maxIssuerPathLength + description: Optional. Refers to the path length restriction X.509 extension. For a CA certificate, this value describes the depth of subordinate CA certificates that are allowed. If this value is less than 0, the request will fail. If this value is missing, the max path length will be omitted from the CA certificate. + - !ruby/object:Api::Type::Array + name: policyIds + description: Optional. Describes the X.509 certificate policy object identifiers, per https://tools.ietf.org/html/rfc5280#section-4.2.1.4. + item_type: !ruby/object:Api::Type::NestedObject + name: policyId + description: Optional. Describes the X.509 certificate policy object identifiers, per https://tools.ietf.org/html/rfc5280#section-4.2.1.4. + properties: + - !ruby/object:Api::Type::Array + name: objectIdPath + description: Required. The parts of an OID path. The most significant parts of the path come first. + required: true + item_type: Api::Type::Integer + - !ruby/object:Api::Type::Array + name: aiaOcspServers + description: Optional. Describes Online Certificate Status Protocol (OCSP) endpoint addresses that appear in the "Authority Information Access" extension in the certificate. + item_type: Api::Type::String + - !ruby/object:Api::Type::Array + name: additionalExtensions + description: Optional. Describes custom X.509 extensions. + item_type: !ruby/object:Api::Type::NestedObject + name: additionalExtension + description: Optional. Describes custom X.509 extensions. + properties: + - !ruby/object:Api::Type::NestedObject + name: objectId + description: Required. The OID for this X.509 extension. + required: true + properties: + - !ruby/object:Api::Type::Array + name: objectIdPath + description: Required. The parts of an OID path. The most significant parts of the path come first. + required: true + item_type: Api::Type::Integer + - !ruby/object:Api::Type::Boolean + name: critical + description: Optional. Indicates whether or not this extension is critical (i.e., if the client does not know how to handle this extension, the client should consider this to be an error). + send_empty_value: true + - !ruby/object:Api::Type::String + name: value + description: Required. The value of this X.509 extension. + required: true + - !ruby/object:Api::Type::NestedObject + name: identityConstraints + description: Optional. Describes constraints on identities that may be appear in Certificates issued using this template. If this is omitted, then this template will not add restrictions on a certificate's identity. + properties: + - !ruby/object:Api::Type::NestedObject + name: celExpression + description: Optional. A CEL expression that may be used to validate the resolved X.509 Subject and/or Subject Alternative Name before a certificate is signed. To see the full allowed syntax and some examples, see https://cloud.google.com/certificate-authority-service/docs/using-cel + properties: + - !ruby/object:Api::Type::String + name: expression + description: Textual representation of an expression in Common Expression Language syntax. + - !ruby/object:Api::Type::String + name: title + description: Optional. Title for the expression, i.e. a short string describing its purpose. This can be used e.g. in UIs which allow to enter the expression. + - !ruby/object:Api::Type::String + name: description + description: Optional. Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. + - !ruby/object:Api::Type::String + name: location + description: Optional. String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. + - !ruby/object:Api::Type::Boolean + name: allowSubjectPassthrough + description: Required. If this is true, the Subject field may be copied from a certificate request into the signed certificate. Otherwise, the requested Subject will be discarded. + required: true + send_empty_value: true + - !ruby/object:Api::Type::Boolean + name: allowSubjectAltNamesPassthrough + description: Required. If this is true, the SubjectAltNames extension may be copied from a certificate request into the signed certificate. Otherwise, the requested SubjectAltNames will be discarded. + required: true + send_empty_value: true + - !ruby/object:Api::Type::NestedObject + name: passthroughExtensions + description: Optional. Describes the set of X.509 extensions that may appear in a Certificate issued using this CertificateTemplate. If a certificate request sets extensions that don't appear in the passthrough_extensions, those extensions will be dropped. If the issuing CaPool's IssuancePolicy defines baseline_values that don't appear here, the certificate issuance request will fail. If this is omitted, then this template will not add restrictions on a certificate's X.509 extensions. These constraints do not apply to X.509 extensions set in this CertificateTemplate's predefined_values. + properties: + - !ruby/object:Api::Type::Array + name: knownExtensions + description: Optional. A set of named X.509 extensions. Will be combined with additional_extensions to determine the full set of X.509 extensions. + item_type: Api::Type::Enum + - !ruby/object:Api::Type::Array + name: additionalExtensions + description: Optional. A set of ObjectIds identifying custom X.509 extensions. Will be combined with known_extensions to determine the full set of X.509 extensions. + item_type: !ruby/object:Api::Type::NestedObject + name: additionalExtension + description: Optional. A set of ObjectIds identifying custom X.509 extensions. Will be combined with known_extensions to determine the full set of X.509 extensions. + properties: + - !ruby/object:Api::Type::Array + name: objectIdPath + description: Required. The parts of an OID path. The most significant parts of the path come first. + required: true + item_type: Api::Type::Integer + - !ruby/object:Api::Type::String + name: maximumLifetime + description: Optional. The maximum lifetime allowed for all issued certificates that use this template. If the issuing CaPool's IssuancePolicy specifies a maximum lifetime the minimum of the two durations will be the maximum lifetime for issued. Note that if the issuing CertificateAuthority expires before a Certificate's requested maximum_lifetime, the effective lifetime will be explicitly truncated to match it. + - !ruby/object:Api::Type::String + name: description + description: Optional. A human-readable description of scenarios this template is intended for. + - !ruby/object:Api::Type::String + name: createTime + description: Output only. The time at which this CertificateTemplate was created. + output: true + - !ruby/object:Api::Type::String + name: updateTime + description: Output only. The time at which this CertificateTemplate was updated. + output: true + - !ruby/object:Api::Type::KeyValueLabels + name: labels + description: Optional. Labels with user-defined metadata. diff --git a/mmv1/templates/terraform/datasource_iam.html.markdown.erb b/mmv1/templates/terraform/datasource_iam.html.markdown.erb index f1a704b42ace..8ff15bcd4c66 100644 --- a/mmv1/templates/terraform/datasource_iam.html.markdown.erb +++ b/mmv1/templates/terraform/datasource_iam.html.markdown.erb @@ -90,7 +90,7 @@ The following arguments are supported: <% url_properties.each do |param| -%> <% if param.name == "name" -%> * `<%= object.iam_policy.parent_resource_attribute || object.name.underscore -%>` - (Required) Used to find the parent resource to bind the IAM policy to -<% elsif ["region", "zone"].include?(param.name.underscore) -%> +<% elsif ["location", "region", "zone"].include?(param.name.underscore) -%> * `<%= param.name.underscore -%>` - (Optional) <%= param.description -%> Used to find the parent resource to bind the IAM policy to. If not specified, the value will be parsed from the identifier of the parent resource. If no <%= param.name.underscore -%> is provided in the parent identifier and no <%= param.name.underscore -%> is specified, it is taken from the provider configuration. diff --git a/mmv1/templates/terraform/examples/privateca_template_basic.tf.erb b/mmv1/templates/terraform/examples/privateca_template_basic.tf.erb index cd6310414796..7af7c93673b9 100644 --- a/mmv1/templates/terraform/examples/privateca_template_basic.tf.erb +++ b/mmv1/templates/terraform/examples/privateca_template_basic.tf.erb @@ -2,6 +2,7 @@ resource "google_privateca_certificate_template" "<%= ctx[:primary_resource_id] %>" { name = "<%= ctx[:vars]["name"] %>" location = "us-central1" + description = "A sample certificate template" identity_constraints { allow_subject_alt_names_passthrough = true @@ -14,5 +15,60 @@ resource "google_privateca_certificate_template" "<%= ctx[:primary_resource_id] title = "Sample expression" } } + + maximum_lifetime = "86400s" + + passthrough_extensions { + additional_extensions { + object_id_path = [1, 6] + } + known_extensions = ["EXTENDED_KEY_USAGE"] + } + + predefined_values { + additional_extensions { + object_id { + object_id_path = [1, 6] + } + value = "c3RyaW5nCg==" + critical = true + } + aia_ocsp_servers = ["string"] + ca_options { + is_ca = false + max_issuer_path_length = 6 + } + key_usage { + base_key_usage { + cert_sign = false + content_commitment = true + crl_sign = false + data_encipherment = true + decipher_only = true + digital_signature = true + encipher_only = true + key_agreement = true + key_encipherment = true + } + extended_key_usage { + client_auth = true + code_signing = true + email_protection = true + ocsp_signing = true + server_auth = true + time_stamping = true + } + unknown_extended_key_usages { + object_id_path = [1, 6] + } + } + policy_ids { + object_id_path = [1, 6] + } + } + + labels = { + label-one = "value-one" + } } # [END privateca_create_certificate_template] diff --git a/mmv1/templates/terraform/resource_iam.html.markdown.erb b/mmv1/templates/terraform/resource_iam.html.markdown.erb index 5dbae57f4d14..ae6f897648a5 100644 --- a/mmv1/templates/terraform/resource_iam.html.markdown.erb +++ b/mmv1/templates/terraform/resource_iam.html.markdown.erb @@ -219,7 +219,7 @@ The following arguments are supported: <% url_properties.each do |param| -%> <% if param.name == "name" -%> * `<%= object.iam_policy.parent_resource_attribute || object.name.underscore -%>` - (Required) Used to find the parent resource to bind the IAM policy to -<% elsif ["region", "zone"].include?(param.name.underscore) -%> +<% elsif ["location", "region", "zone"].include?(param.name.underscore) -%> * `<%= param.name.underscore -%>` - (Optional) <%= param.description -%> Used to find the parent resource to bind the IAM policy to. If not specified, the value will be parsed from the identifier of the parent resource. If no <%= param.name.underscore -%> is provided in the parent identifier and no <%= param.name.underscore -%> is specified, it is taken from the provider configuration. diff --git a/mmv1/third_party/terraform/services/privateca/resource_privateca_certificate_template_test.go b/mmv1/third_party/terraform/services/privateca/resource_privateca_certificate_template_test.go new file mode 100644 index 000000000000..7f1420946e29 --- /dev/null +++ b/mmv1/third_party/terraform/services/privateca/resource_privateca_certificate_template_test.go @@ -0,0 +1,432 @@ +package privateca_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + "github.com/hashicorp/terraform-provider-google/google/acctest" + "github.com/hashicorp/terraform-provider-google/google/envvar" +) + +func TestAccPrivatecaCertificateTemplate_BasicCertificateTemplate(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "project_name": envvar.GetTestProjectFromEnv(), + "region": envvar.GetTestRegionFromEnv(), + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckPrivatecaCertificateTemplateDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccPrivatecaCertificateTemplate_BasicCertificateTemplate(context), + }, + { + ResourceName: "google_privateca_certificate_template.primary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"predefined_values.0.key_usage.0.extended_key_usage", "labels", "terraform_labels"}, + }, + { + Config: testAccPrivatecaCertificateTemplate_BasicCertificateTemplateUpdate0(context), + }, + { + ResourceName: "google_privateca_certificate_template.primary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"predefined_values.0.key_usage.0.extended_key_usage", "labels", "terraform_labels"}, + }, + }, + }) +} + +func TestAccPrivatecaCertificateTemplate_BasicCertificateTemplateLongForm(t *testing.T) { + t.Parallel() + + context := map[string]interface{}{ + "project_name": envvar.GetTestProjectFromEnv(), + "region": envvar.GetTestRegionFromEnv(), + "random_suffix": acctest.RandString(t, 10), + } + + acctest.VcrTest(t, resource.TestCase{ + PreCheck: func() { acctest.AccTestPreCheck(t) }, + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), + CheckDestroy: testAccCheckPrivatecaCertificateTemplateDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccPrivatecaCertificateTemplate_BasicCertificateTemplateLongForm(context), + }, + { + ResourceName: "google_privateca_certificate_template.primary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"predefined_values.0.key_usage.0.extended_key_usage", "labels", "terraform_labels", "project", "location", "name"}, + }, + { + Config: testAccPrivatecaCertificateTemplate_BasicCertificateTemplateLongFormUpdate0(context), + }, + { + ResourceName: "google_privateca_certificate_template.primary", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"predefined_values.0.key_usage.0.extended_key_usage", "labels", "terraform_labels", "project", "location", "name"}, + }, + }, + }) +} + +func testAccPrivatecaCertificateTemplate_BasicCertificateTemplate(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_privateca_certificate_template" "primary" { + location = "%{region}" + name = "tf-test-template%{random_suffix}" + maximum_lifetime = "86400s" + description = "An updated sample certificate template" + + identity_constraints { + allow_subject_alt_names_passthrough = true + allow_subject_passthrough = true + + cel_expression { + description = "Always true" + expression = "true" + location = "any.file.anywhere" + title = "Sample expression" + } + } + + passthrough_extensions { + additional_extensions { + object_id_path = [1, 6] + } + + known_extensions = ["EXTENDED_KEY_USAGE"] + } + + predefined_values { + additional_extensions { + object_id { + object_id_path = [1, 6] + } + + value = "c3RyaW5nCg==" + critical = true + } + + aia_ocsp_servers = ["string"] + + ca_options { + is_ca = false + max_issuer_path_length = 6 + } + + key_usage { + base_key_usage { + cert_sign = false + content_commitment = true + crl_sign = false + data_encipherment = true + decipher_only = true + digital_signature = true + encipher_only = true + key_agreement = true + key_encipherment = true + } + + extended_key_usage { + client_auth = true + code_signing = true + email_protection = true + ocsp_signing = true + server_auth = true + time_stamping = true + } + + unknown_extended_key_usages { + object_id_path = [1, 6] + } + } + + policy_ids { + object_id_path = [1, 6] + } + } + + project = "%{project_name}" + + labels = { + label-two = "value-two" + } +} + + +`, context) +} + +func testAccPrivatecaCertificateTemplate_BasicCertificateTemplateUpdate0(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_privateca_certificate_template" "primary" { + location = "%{region}" + name = "tf-test-template%{random_suffix}" + maximum_lifetime = "172800s" + description = "A sample certificate template" + + identity_constraints { + allow_subject_alt_names_passthrough = false + allow_subject_passthrough = false + + cel_expression { + description = "Always false" + expression = "false" + location = "update.certificate_template.json" + title = "New sample expression" + } + } + + passthrough_extensions { + additional_extensions { + object_id_path = [1, 7] + } + + known_extensions = ["BASE_KEY_USAGE"] + } + + predefined_values { + additional_extensions { + object_id { + object_id_path = [1, 7] + } + + value = "bmV3LXN0cmluZw==" + critical = false + } + + aia_ocsp_servers = ["new-string"] + + ca_options { + is_ca = true + max_issuer_path_length = 7 + } + + key_usage { + base_key_usage { + cert_sign = true + content_commitment = false + crl_sign = true + data_encipherment = false + decipher_only = false + digital_signature = false + encipher_only = false + key_agreement = false + key_encipherment = false + } + + extended_key_usage { + client_auth = false + code_signing = false + email_protection = false + ocsp_signing = false + server_auth = false + time_stamping = false + } + + unknown_extended_key_usages { + object_id_path = [1, 7] + } + } + + policy_ids { + object_id_path = [1, 7] + } + } + + project = "%{project_name}" + + labels = { + label-one = "value-one" + } +} + + +`, context) +} + +func testAccPrivatecaCertificateTemplate_BasicCertificateTemplateLongForm(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_privateca_certificate_template" "primary" { + location = "long/form/%{region}" + name = "long/form/tf-test-template%{random_suffix}" + description = "An updated sample certificate template" + + identity_constraints { + allow_subject_alt_names_passthrough = true + allow_subject_passthrough = true + + cel_expression { + description = "Always true" + expression = "true" + location = "any.file.anywhere" + title = "Sample expression" + } + } + + passthrough_extensions { + additional_extensions { + object_id_path = [1, 6] + } + + known_extensions = ["EXTENDED_KEY_USAGE"] + } + + predefined_values { + additional_extensions { + object_id { + object_id_path = [1, 6] + } + + value = "c3RyaW5nCg==" + critical = true + } + + aia_ocsp_servers = ["string"] + + ca_options { + is_ca = false + max_issuer_path_length = 6 + } + + key_usage { + base_key_usage { + cert_sign = false + content_commitment = true + crl_sign = false + data_encipherment = true + decipher_only = true + digital_signature = true + encipher_only = true + key_agreement = true + key_encipherment = true + } + + extended_key_usage { + client_auth = true + code_signing = true + email_protection = true + ocsp_signing = true + server_auth = true + time_stamping = true + } + + unknown_extended_key_usages { + object_id_path = [1, 6] + } + } + + policy_ids { + object_id_path = [1, 6] + } + } + + project = "projects/%{project_name}" + + labels = { + label-two = "value-two" + } +} + + +`, context) +} + +func testAccPrivatecaCertificateTemplate_BasicCertificateTemplateLongFormUpdate0(context map[string]interface{}) string { + return acctest.Nprintf(` +resource "google_privateca_certificate_template" "primary" { + location = "long/form/%{region}" + name = "long/form/tf-test-template%{random_suffix}" + description = "A sample certificate template" + + identity_constraints { + allow_subject_alt_names_passthrough = false + allow_subject_passthrough = false + + cel_expression { + description = "Always false" + expression = "false" + location = "update.certificate_template.json" + title = "New sample expression" + } + } + + passthrough_extensions { + additional_extensions { + object_id_path = [1, 7] + } + + known_extensions = ["BASE_KEY_USAGE"] + } + + predefined_values { + additional_extensions { + object_id { + object_id_path = [1, 7] + } + + value = "bmV3LXN0cmluZw==" + critical = false + } + + aia_ocsp_servers = ["new-string"] + + ca_options { + is_ca = true + max_issuer_path_length = 7 + } + + key_usage { + base_key_usage { + cert_sign = true + content_commitment = false + crl_sign = true + data_encipherment = false + decipher_only = false + digital_signature = false + encipher_only = false + key_agreement = false + key_encipherment = false + } + + extended_key_usage { + client_auth = false + code_signing = false + email_protection = false + ocsp_signing = false + server_auth = false + time_stamping = false + } + + unknown_extended_key_usages { + object_id_path = [1, 7] + } + } + + policy_ids { + object_id_path = [1, 7] + } + } + + project = "projects/%{project_name}" + + labels = { + label-one = "value-one" + } +} + + +`, context) +} diff --git a/tpgtools/overrides/privateca/beta/certificate_template.yaml b/tpgtools/overrides/privateca/beta/certificate_template.yaml deleted file mode 100644 index 9014b1241575..000000000000 --- a/tpgtools/overrides/privateca/beta/certificate_template.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -- type: CUSTOMIZE_DIFF - details: - functions: - - tpgresource.DefaultProviderProject diff --git a/tpgtools/overrides/privateca/beta/tpgtools_product.yaml b/tpgtools/overrides/privateca/beta/tpgtools_product.yaml deleted file mode 100644 index cfb77fb59f29..000000000000 --- a/tpgtools/overrides/privateca/beta/tpgtools_product.yaml +++ /dev/null @@ -1,8 +0,0 @@ -## product level overrides - -- type: PRODUCT_BASE_PATH - details: - skip: true -- type: PRODUCT_DOCS_SECTION - details: - docssection: Certificate Authority Service diff --git a/tpgtools/overrides/privateca/certificate_template.yaml b/tpgtools/overrides/privateca/certificate_template.yaml deleted file mode 100644 index 9014b1241575..000000000000 --- a/tpgtools/overrides/privateca/certificate_template.yaml +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright 2021 Google LLC. All Rights Reserved. -# -# 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. -- type: CUSTOMIZE_DIFF - details: - functions: - - tpgresource.DefaultProviderProject diff --git a/tpgtools/overrides/privateca/samples/certificatetemplate/meta.yaml b/tpgtools/overrides/privateca/samples/certificatetemplate/meta.yaml deleted file mode 100644 index f2aa65e0d9d2..000000000000 --- a/tpgtools/overrides/privateca/samples/certificatetemplate/meta.yaml +++ /dev/null @@ -1,2 +0,0 @@ -ignore_read: - - predefined_values.0.key_usage.0.extended_key_usage diff --git a/tpgtools/overrides/privateca/tpgtools_product.yaml b/tpgtools/overrides/privateca/tpgtools_product.yaml deleted file mode 100644 index cfb77fb59f29..000000000000 --- a/tpgtools/overrides/privateca/tpgtools_product.yaml +++ /dev/null @@ -1,8 +0,0 @@ -## product level overrides - -- type: PRODUCT_BASE_PATH - details: - skip: true -- type: PRODUCT_DOCS_SECTION - details: - docssection: Certificate Authority Service