From 0013e51b022ebc6f9c5d02e7aa0bf296971655a2 Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Thu, 8 Sep 2022 20:40:44 +0000 Subject: [PATCH] Allow subordinate CA data sources in all states (#6496) Co-authored-by: J. Cameron McDonald Signed-off-by: Modular Magician --- .changelog/6496.txt | 3 +++ google/data_source_certificate_authority.go | 4 ++-- website/docs/d/privateca_certificate_authority.html.markdown | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .changelog/6496.txt diff --git a/.changelog/6496.txt b/.changelog/6496.txt new file mode 100644 index 00000000000..c1ee1c5ce0a --- /dev/null +++ b/.changelog/6496.txt @@ -0,0 +1,3 @@ +```release-note:bug +privateca: fixed an issue that blocked subordinate CA data sources when `state` was not `AWAITING_USER_ACTIVATION` +``` diff --git a/google/data_source_certificate_authority.go b/google/data_source_certificate_authority.go index bdbff677d0f..cf85b4a2ecc 100644 --- a/google/data_source_certificate_authority.go +++ b/google/data_source_certificate_authority.go @@ -43,8 +43,8 @@ func dataSourcePrivatecaCertificateAuthorityRead(d *schema.ResourceData, meta in return err } - // pem_csr is only applicable for SUBORDINATE CertificateAuthorities - if d.Get("type") == "SUBORDINATE" { + // pem_csr is only applicable for SUBORDINATE CertificateAuthorities when their state is AWAITING_USER_ACTIVATION + if d.Get("type") == "SUBORDINATE" && d.Get("state") == "AWAITING_USER_ACTIVATION" { url, err := replaceVars(d, config, "{{PrivatecaBasePath}}projects/{{project}}/locations/{{location}}/caPools/{{pool}}/certificateAuthorities/{{certificate_authority_id}}:fetch") if err != nil { return err diff --git a/website/docs/d/privateca_certificate_authority.html.markdown b/website/docs/d/privateca_certificate_authority.html.markdown index 4f59184873d..25096c46306 100644 --- a/website/docs/d/privateca_certificate_authority.html.markdown +++ b/website/docs/d/privateca_certificate_authority.html.markdown @@ -6,7 +6,7 @@ description: |- --- # google_privateca_certificate_authority -Get info about a Google Cloud IAP Client. +Get info about a Google CAS Certificate Authority. ## Example Usage @@ -42,4 +42,4 @@ The following arguments are supported: See [google_privateca_certificate_authority](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/privateca_certificate_authority) resource for details of the available attributes. -* `pem_csr` - The PEM-encoded signed certificate signing request (CSR). This is only set on subordinate certificate authorities. \ No newline at end of file +* `pem_csr` - The PEM-encoded signed certificate signing request (CSR). This is only set on subordinate certificate authorities that are awaiting user activation.