Skip to content

Commit

Permalink
Unmark as beta, skip test as privateca does not have beta endpoints (#…
Browse files Browse the repository at this point in the history
…5247) (#3669)

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician authored Sep 28, 2021
1 parent 6b89bbc commit 8644ec1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 101 deletions.
3 changes: 3 additions & 0 deletions .changelog/5247.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
Original file line number Diff line number Diff line change
Expand Up @@ -183,102 +183,6 @@ resource "google_privateca_certificate_authority" "default" {
`, context)
}

func TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthorityByoKeyExample(t *testing.T) {
skipIfVcr(t)
t.Parallel()

context := map[string]interface{}{
"kms_key_name": BootstrapKMSKeyWithPurposeInLocation(t, "ASYMMETRIC_SIGN", "us-central1").CryptoKey.Name,
"pool_name": BootstrapSharedCaPoolInLocation(t, "us-central1"),
"pool_location": "us-central1",
"random_suffix": randString(t, 10),
}

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProvidersOiCS,
CheckDestroy: testAccCheckPrivatecaCertificateAuthorityDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccPrivatecaCertificateAuthority_privatecaCertificateAuthorityByoKeyExample(context),
},
{
ResourceName: "google_privateca_certificate_authority.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"ignore_active_certificates_on_deletion", "location", "certificate_authority_id", "pool"},
},
},
})
}

func testAccPrivatecaCertificateAuthority_privatecaCertificateAuthorityByoKeyExample(context map[string]interface{}) string {
return Nprintf(`
resource "google_project_service_identity" "privateca_sa" {
service = "privateca.googleapis.com"
}
resource "google_kms_crypto_key_iam_binding" "privateca_sa_keyuser_signerverifier" {
crypto_key_id = "%{kms_key_name}"
role = "roles/cloudkms.signerVerifier"
members = [
"serviceAccount:${google_project_service_identity.privateca_sa.email}",
]
}
resource "google_kms_crypto_key_iam_binding" "privateca_sa_keyuser_viewer" {
crypto_key_id = "%{kms_key_name}"
role = "roles/viewer"
members = [
"serviceAccount:${google_project_service_identity.privateca_sa.email}",
]
}
resource "google_privateca_certificate_authority" "default" {
// This example assumes this pool already exists.
// Pools cannot be deleted in normal test circumstances, so we depend on static pools
pool = "%{pool_name}"
certificate_authority_id = "tf-test-my-certificate-authority%{random_suffix}"
location = "%{pool_location}"
key_spec {
cloud_kms_key_version = "%{kms_key_name}/cryptoKeyVersions/1"
}
config {
subject_config {
subject {
organization = "Example, Org."
common_name = "Example Authority"
}
}
x509_config {
ca_options {
# is_ca *MUST* be true for certificate authorities
is_ca = true
max_issuer_path_length = 10
}
key_usage {
base_key_usage {
# cert_sign and crl_sign *MUST* be true for certificate authorities
cert_sign = true
crl_sign = true
}
extended_key_usage {
server_auth = false
}
}
}
}
depends_on = [
google_kms_crypto_key_iam_binding.privateca_sa_keyuser_signerverifier,
google_kms_crypto_key_iam_binding.privateca_sa_keyuser_viewer,
]
}
`, context)
}

func testAccCheckPrivatecaCertificateAuthorityDestroyProducer(t *testing.T) func(s *terraform.State) error {
return func(s *terraform.State) error {
for name, rs := range s.RootModule().Resources {
Expand Down
5 changes: 0 additions & 5 deletions website/docs/r/privateca_certificate_authority.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,6 @@ resource "google_privateca_certificate_authority" "default" {
type = "SUBORDINATE"
}
```
<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_certificate_authority_byo_key&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%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 Certificate Authority Byo Key


Expand Down

0 comments on commit 8644ec1

Please sign in to comment.