| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: MMv1 *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # This file is automatically generated by Magic Modules and manual |
| # changes will be clobbered when the file is regenerated. |
| # |
| # Please read more about how to change this file in |
| # .github/CONTRIBUTING.md. |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "Certificate Authority Service" |
| description: |- |
| A CaPool represents a group of CertificateAuthorities that form a trust anchor. |
| --- |
| |
| # google\_privateca\_ca\_pool |
| |
| A CaPool represents a group of CertificateAuthorities that form a trust anchor. A CaPool can be used to manage |
| issuance policies for one or more CertificateAuthority resources and to rotate CA certificates in and out of the |
| trust anchor. |
| |
| |
| |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=privateca_capool_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Privateca Capool Basic |
| |
| |
| ```hcl |
| resource "google_privateca_ca_pool" "default" { |
| name = "my-pool" |
| location = "us-central1" |
| tier = "ENTERPRISE" |
| publishing_options { |
| publish_ca_cert = true |
| publish_crl = true |
| } |
| labels = { |
| foo = "bar" |
| } |
| } |
| ``` |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=privateca_capool_all_fields&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Privateca Capool All Fields |
| |
| |
| ```hcl |
| resource "google_privateca_ca_pool" "default" { |
| name = "my-pool" |
| location = "us-central1" |
| tier = "ENTERPRISE" |
| publishing_options { |
| publish_ca_cert = false |
| publish_crl = true |
| encoding_format = "PEM" |
| } |
| labels = { |
| foo = "bar" |
| } |
| issuance_policy { |
| allowed_key_types { |
| elliptic_curve { |
| signature_algorithm = "ECDSA_P256" |
| } |
| } |
| allowed_key_types { |
| rsa { |
| min_modulus_size = 5 |
| max_modulus_size = 10 |
| } |
| } |
| maximum_lifetime = "50000s" |
| allowed_issuance_modes { |
| allow_csr_based_issuance = true |
| allow_config_based_issuance = true |
| } |
| identity_constraints { |
| allow_subject_passthrough = true |
| allow_subject_alt_names_passthrough = true |
| cel_expression { |
| expression = "subject_alt_names.all(san, san.type == DNS || san.type == EMAIL )" |
| title = "My title" |
| } |
| } |
| baseline_values { |
| aia_ocsp_servers = ["example.com"] |
| additional_extensions { |
| critical = true |
| value = "asdf" |
| object_id { |
| object_id_path = [1, 7] |
| } |
| } |
| policy_ids { |
| object_id_path = [1, 5] |
| } |
| policy_ids { |
| object_id_path = [1, 5, 7] |
| } |
| ca_options { |
| is_ca = true |
| max_issuer_path_length = 10 |
| } |
| key_usage { |
| base_key_usage { |
| digital_signature = true |
| content_commitment = true |
| key_encipherment = false |
| data_encipherment = true |
| key_agreement = true |
| cert_sign = false |
| crl_sign = true |
| decipher_only = true |
| } |
| extended_key_usage { |
| server_auth = true |
| client_auth = false |
| email_protection = true |
| code_signing = true |
| time_stamping = true |
| } |
| } |
| name_constraints { |
| critical = true |
| permitted_dns_names = ["*.example1.com", "*.example2.com"] |
| excluded_dns_names = ["*.deny.example1.com", "*.deny.example2.com"] |
| permitted_ip_ranges = ["10.0.0.0/8", "11.0.0.0/8"] |
| excluded_ip_ranges = ["10.1.1.0/24", "11.1.1.0/24"] |
| permitted_email_addresses = [".example1.com", ".example2.com"] |
| excluded_email_addresses = [".deny.example1.com", ".deny.example2.com"] |
| permitted_uris = [".example1.com", ".example2.com"] |
| excluded_uris = [".deny.example1.com", ".deny.example2.com"] |
| } |
| } |
| } |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `name` - |
| (Required) |
| The name for this CaPool. |
| |
| * `tier` - |
| (Required) |
| The Tier of this CaPool. |
| Possible values are: `ENTERPRISE`, `DEVOPS`. |
| |
| * `location` - |
| (Required) |
| Location of the CaPool. A full list of valid locations can be found by |
| running `gcloud privateca locations list`. |
| |
| |
| - - - |
| |
| |
| * `issuance_policy` - |
| (Optional) |
| The IssuancePolicy to control how Certificates will be issued from this CaPool. |
| Structure is [documented below](#nested_issuance_policy). |
| |
| * `publishing_options` - |
| (Optional) |
| The PublishingOptions to follow when issuing Certificates from any CertificateAuthority in this CaPool. |
| Structure is [documented below](#nested_publishing_options). |
| |
| * `labels` - |
| (Optional) |
| Labels with user-defined metadata. |
| An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": |
| "1.3kg", "count": "3" }. |
| |
| **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. |
| Please refer to the field `effective_labels` for all of the labels present on the resource. |
| |
| * `project` - (Optional) The ID of the project in which the resource belongs. |
| If it is not provided, the provider project is used. |
| |
| |
| <a name="nested_issuance_policy"></a>The `issuance_policy` block supports: |
| |
| * `allowed_key_types` - |
| (Optional) |
| If any AllowedKeyType is specified, then the certificate request's public key must match one of the key types listed here. |
| Otherwise, any key may be used. |
| Structure is [documented below](#nested_allowed_key_types). |
| |
| * `maximum_lifetime` - |
| (Optional) |
| The maximum lifetime allowed for issued Certificates. Note that if the issuing CertificateAuthority |
| expires before a Certificate's requested maximumLifetime, the effective lifetime will be explicitly truncated to match it. |
| |
| * `allowed_issuance_modes` - |
| (Optional) |
| IssuanceModes specifies the allowed ways in which Certificates may be requested from this CaPool. |
| Structure is [documented below](#nested_allowed_issuance_modes). |
| |
| * `identity_constraints` - |
| (Optional) |
| Describes constraints on identities that may appear in Certificates issued through this CaPool. |
| If this is omitted, then this CaPool will not add restrictions on a certificate's identity. |
| Structure is [documented below](#nested_identity_constraints). |
| |
| * `baseline_values` - |
| (Optional) |
| A set of X.509 values that will be applied to all certificates issued through this CaPool. If a certificate request |
| includes conflicting values for the same properties, they will be overwritten by the values defined here. If a certificate |
| request uses a CertificateTemplate that defines conflicting predefinedValues for the same properties, the certificate |
| issuance request will fail. |
| Structure is [documented below](#nested_baseline_values). |
| |
| |
| <a name="nested_allowed_key_types"></a>The `allowed_key_types` block supports: |
| |
| * `rsa` - |
| (Optional) |
| Describes an RSA key that may be used in a Certificate issued from a CaPool. |
| Structure is [documented below](#nested_rsa). |
| |
| * `elliptic_curve` - |
| (Optional) |
| Represents an allowed Elliptic Curve key type. |
| Structure is [documented below](#nested_elliptic_curve). |
| |
| |
| <a name="nested_rsa"></a>The `rsa` block supports: |
| |
| * `min_modulus_size` - |
| (Optional) |
| The minimum allowed RSA modulus size, in bits. If this is not set, or if set to zero, the |
| service-level min RSA modulus size will continue to apply. |
| |
| * `max_modulus_size` - |
| (Optional) |
| The maximum allowed RSA modulus size, in bits. If this is not set, or if set to zero, the |
| service will not enforce an explicit upper bound on RSA modulus sizes. |
| |
| <a name="nested_elliptic_curve"></a>The `elliptic_curve` block supports: |
| |
| * `signature_algorithm` - |
| (Required) |
| The algorithm used. |
| Possible values are: `ECDSA_P256`, `ECDSA_P384`, `EDDSA_25519`. |
| |
| <a name="nested_allowed_issuance_modes"></a>The `allowed_issuance_modes` block supports: |
| |
| * `allow_csr_based_issuance` - |
| (Required) |
| When true, allows callers to create Certificates by specifying a CSR. |
| |
| * `allow_config_based_issuance` - |
| (Required) |
| When true, allows callers to create Certificates by specifying a CertificateConfig. |
| |
| <a name="nested_identity_constraints"></a>The `identity_constraints` block supports: |
| |
| * `allow_subject_passthrough` - |
| (Required) |
| If this is set, the Subject field may be copied from a certificate request into the signed certificate. |
| Otherwise, the requested Subject will be discarded. |
| |
| * `allow_subject_alt_names_passthrough` - |
| (Required) |
| If this is set, the SubjectAltNames extension may be copied from a certificate request into the signed certificate. |
| Otherwise, the requested SubjectAltNames will be discarded. |
| |
| * `cel_expression` - |
| (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/cel-guide |
| Structure is [documented below](#nested_cel_expression). |
| |
| |
| <a name="nested_cel_expression"></a>The `cel_expression` block supports: |
| |
| * `expression` - |
| (Required) |
| Textual representation of an expression in Common Expression Language syntax. |
| |
| * `title` - |
| (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. |
| |
| * `description` - |
| (Optional) |
| Description of the expression. This is a longer text which describes the expression, e.g. when hovered over it in a UI. |
| |
| * `location` - |
| (Optional) |
| String indicating the location of the expression for error reporting, e.g. a file name and a position in the file. |
| |
| <a name="nested_baseline_values"></a>The `baseline_values` block supports: |
| |
| * `additional_extensions` - |
| (Optional) |
| Specifies an X.509 extension, which may be used in different parts of X.509 objects like certificates, CSRs, and CRLs. |
| Structure is [documented below](#nested_additional_extensions). |
| |
| * `policy_ids` - |
| (Optional) |
| Describes the X.509 certificate policy object identifiers, per https://tools.ietf.org/html/rfc5280#section-4.2.1.4. |
| Structure is [documented below](#nested_policy_ids). |
| |
| * `aia_ocsp_servers` - |
| (Optional) |
| Describes Online Certificate Status Protocol (OCSP) endpoint addresses that appear in the |
| "Authority Information Access" extension in the certificate. |
| |
| * `ca_options` - |
| (Required) |
| Describes values that are relevant in a CA certificate. |
| Structure is [documented below](#nested_ca_options). |
| |
| * `key_usage` - |
| (Required) |
| Indicates the intended use for keys that correspond to a certificate. |
| Structure is [documented below](#nested_key_usage). |
| |
| * `name_constraints` - |
| (Optional) |
| Describes the X.509 name constraints extension. |
| Structure is [documented below](#nested_name_constraints). |
| |
| |
| <a name="nested_additional_extensions"></a>The `additional_extensions` block supports: |
| |
| * `critical` - |
| (Required) |
| 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). |
| |
| * `value` - |
| (Required) |
| The value of this X.509 extension. A base64-encoded string. |
| |
| * `object_id` - |
| (Required) |
| Describes values that are relevant in a CA certificate. |
| Structure is [documented below](#nested_object_id). |
| |
| |
| <a name="nested_object_id"></a>The `object_id` block supports: |
| |
| * `object_id_path` - |
| (Required) |
| An ObjectId specifies an object identifier (OID). These provide context and describe types in ASN.1 messages. |
| |
| <a name="nested_policy_ids"></a>The `policy_ids` block supports: |
| |
| * `object_id_path` - |
| (Required) |
| An ObjectId specifies an object identifier (OID). These provide context and describe types in ASN.1 messages. |
| |
| <a name="nested_ca_options"></a>The `ca_options` block supports: |
| |
| * `is_ca` - |
| (Optional) |
| When true, the "CA" in Basic Constraints extension will be set to true. |
| |
| * `non_ca` - |
| (Optional) |
| When true, the "CA" in Basic Constraints extension will be set to false. |
| If both `is_ca` and `non_ca` are unset, the extension will be omitted from the CA certificate. |
| |
| * `max_issuer_path_length` - |
| (Optional) |
| Refers to the "path length constraint" in Basic Constraints 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. |
| |
| * `zero_max_issuer_path_length` - |
| (Optional) |
| When true, the "path length constraint" in Basic Constraints extension will be set to 0. |
| if both `max_issuer_path_length` and `zero_max_issuer_path_length` are unset, |
| the max path length will be omitted from the CA certificate. |
| |
| <a name="nested_key_usage"></a>The `key_usage` block supports: |
| |
| * `base_key_usage` - |
| (Required) |
| Describes high-level ways in which a key may be used. |
| Structure is [documented below](#nested_base_key_usage). |
| |
| * `extended_key_usage` - |
| (Required) |
| Describes high-level ways in which a key may be used. |
| Structure is [documented below](#nested_extended_key_usage). |
| |
| * `unknown_extended_key_usages` - |
| (Optional) |
| An ObjectId specifies an object identifier (OID). These provide context and describe types in ASN.1 messages. |
| Structure is [documented below](#nested_unknown_extended_key_usages). |
| |
| |
| <a name="nested_base_key_usage"></a>The `base_key_usage` block supports: |
| |
| * `digital_signature` - |
| (Optional) |
| The key may be used for digital signatures. |
| |
| * `content_commitment` - |
| (Optional) |
| The key may be used for cryptographic commitments. Note that this may also be referred to as "non-repudiation". |
| |
| * `key_encipherment` - |
| (Optional) |
| The key may be used to encipher other keys. |
| |
| * `data_encipherment` - |
| (Optional) |
| The key may be used to encipher data. |
| |
| * `key_agreement` - |
| (Optional) |
| The key may be used in a key agreement protocol. |
| |
| * `cert_sign` - |
| (Optional) |
| The key may be used to sign certificates. |
| |
| * `crl_sign` - |
| (Optional) |
| The key may be used sign certificate revocation lists. |
| |
| * `encipher_only` - |
| (Optional) |
| The key may be used to encipher only. |
| |
| * `decipher_only` - |
| (Optional) |
| The key may be used to decipher only. |
| |
| <a name="nested_extended_key_usage"></a>The `extended_key_usage` block supports: |
| |
| * `server_auth` - |
| (Optional) |
| 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. |
| |
| * `client_auth` - |
| (Optional) |
| 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. |
| |
| * `code_signing` - |
| (Optional) |
| Corresponds to OID 1.3.6.1.5.5.7.3.3. Officially described as "Signing of downloadable executable code client authentication". |
| |
| * `email_protection` - |
| (Optional) |
| Corresponds to OID 1.3.6.1.5.5.7.3.4. Officially described as "Email protection". |
| |
| * `time_stamping` - |
| (Optional) |
| Corresponds to OID 1.3.6.1.5.5.7.3.8. Officially described as "Binding the hash of an object to a time". |
| |
| * `ocsp_signing` - |
| (Optional) |
| Corresponds to OID 1.3.6.1.5.5.7.3.9. Officially described as "Signing OCSP responses". |
| |
| <a name="nested_unknown_extended_key_usages"></a>The `unknown_extended_key_usages` block supports: |
| |
| * `object_id_path` - |
| (Required) |
| An ObjectId specifies an object identifier (OID). These provide context and describe types in ASN.1 messages. |
| |
| <a name="nested_name_constraints"></a>The `name_constraints` block supports: |
| |
| * `critical` - |
| (Required) |
| Indicates whether or not the name constraints are marked critical. |
| |
| * `permitted_dns_names` - |
| (Optional) |
| Contains permitted DNS names. Any DNS name that can be |
| constructed by simply adding zero or more labels to |
| the left-hand side of the name satisfies the name constraint. |
| For example, `example.com`, `www.example.com`, `www.sub.example.com` |
| would satisfy `example.com` while `example1.com` does not. |
| |
| * `excluded_dns_names` - |
| (Optional) |
| Contains excluded DNS names. Any DNS name that can be |
| constructed by simply adding zero or more labels to |
| the left-hand side of the name satisfies the name constraint. |
| For example, `example.com`, `www.example.com`, `www.sub.example.com` |
| would satisfy `example.com` while `example1.com` does not. |
| |
| * `permitted_ip_ranges` - |
| (Optional) |
| Contains the permitted IP ranges. For IPv4 addresses, the ranges |
| are expressed using CIDR notation as specified in RFC 4632. |
| For IPv6 addresses, the ranges are expressed in similar encoding as IPv4 |
| addresses. |
| |
| * `excluded_ip_ranges` - |
| (Optional) |
| Contains the excluded IP ranges. For IPv4 addresses, the ranges |
| are expressed using CIDR notation as specified in RFC 4632. |
| For IPv6 addresses, the ranges are expressed in similar encoding as IPv4 |
| addresses. |
| |
| * `permitted_email_addresses` - |
| (Optional) |
| Contains the permitted email addresses. The value can be a particular |
| email address, a hostname to indicate all email addresses on that host or |
| a domain with a leading period (e.g. `.example.com`) to indicate |
| all email addresses in that domain. |
| |
| * `excluded_email_addresses` - |
| (Optional) |
| Contains the excluded email addresses. The value can be a particular |
| email address, a hostname to indicate all email addresses on that host or |
| a domain with a leading period (e.g. `.example.com`) to indicate |
| all email addresses in that domain. |
| |
| * `permitted_uris` - |
| (Optional) |
| Contains the permitted URIs that apply to the host part of the name. |
| The value can be a hostname or a domain with a |
| leading period (like `.example.com`) |
| |
| * `excluded_uris` - |
| (Optional) |
| Contains the excluded URIs that apply to the host part of the name. |
| The value can be a hostname or a domain with a |
| leading period (like `.example.com`) |
| |
| <a name="nested_publishing_options"></a>The `publishing_options` block supports: |
| |
| * `publish_ca_cert` - |
| (Required) |
| When true, publishes each CertificateAuthority's CA certificate and includes its URL in the "Authority Information Access" |
| X.509 extension in all issued Certificates. If this is false, the CA certificate will not be published and the corresponding |
| X.509 extension will not be written in issued certificates. |
| |
| * `publish_crl` - |
| (Required) |
| When true, publishes each CertificateAuthority's CRL and includes its URL in the "CRL Distribution Points" X.509 extension |
| in all issued Certificates. If this is false, CRLs will not be published and the corresponding X.509 extension will not |
| 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: |
| |
| * `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/caPools/{{name}}` |
| |
| * `terraform_labels` - |
| The combination of labels configured directly on the resource |
| and default labels configured on the provider. |
| |
| * `effective_labels` - |
| All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services. |
| |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| |
| - `create` - Default is 20 minutes. |
| - `update` - Default is 20 minutes. |
| - `delete` - Default is 20 minutes. |
| |
| ## Import |
| |
| |
| CaPool can be imported using any of these accepted formats: |
| |
| * `projects/{{project}}/locations/{{location}}/caPools/{{name}}` |
| * `{{project}}/{{location}}/{{name}}` |
| * `{{location}}/{{name}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import CaPool using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/locations/{{location}}/caPools/{{name}}" |
| to = google_privateca_ca_pool.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), CaPool can be imported using one of the formats above. For example: |
| |
| ``` |
| $ terraform import google_privateca_ca_pool.default projects/{{project}}/locations/{{location}}/caPools/{{name}} |
| $ terraform import google_privateca_ca_pool.default {{project}}/{{location}}/{{name}} |
| $ terraform import google_privateca_ca_pool.default {{location}}/{{name}} |
| ``` |
| |
| ## User Project Overrides |
| |
| This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |