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

Unmark as beta, skip test as privateca does not have beta endpoints #10174

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/5247.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
96 changes: 0 additions & 96 deletions google/resource_privateca_certificate_authority_generated_test.go
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