diff --git a/.changelog/3027.txt b/.changelog/3027.txt new file mode 100644 index 0000000000..774d363ace --- /dev/null +++ b/.changelog/3027.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +`binaryauthorization`: moved from beta to ga in anticipation of beta api turndown. +``` diff --git a/.changelog/3032.txt b/.changelog/3032.txt deleted file mode 100644 index 8ec013c069..0000000000 --- a/.changelog/3032.txt +++ /dev/null @@ -1,3 +0,0 @@ -```release-note:none - -``` diff --git a/google-beta/config.go b/google-beta/config.go index ad518c1658..8a2871bbc2 100644 --- a/google-beta/config.go +++ b/google-beta/config.go @@ -221,7 +221,7 @@ var BigQueryDefaultBasePath = "https://www.googleapis.com/bigquery/v2/" var BigqueryDataTransferDefaultBasePath = "https://bigquerydatatransfer.googleapis.com/v1/" var BigtableDefaultBasePath = "https://bigtableadmin.googleapis.com/v2/" var BillingDefaultBasePath = "https://billingbudgets.googleapis.com/v1beta1/" -var BinaryAuthorizationDefaultBasePath = "https://binaryauthorization.googleapis.com/v1beta1/" +var BinaryAuthorizationDefaultBasePath = "https://binaryauthorization.googleapis.com/v1/" var CloudBuildDefaultBasePath = "https://cloudbuild.googleapis.com/v1/" var CloudFunctionsDefaultBasePath = "https://cloudfunctions.googleapis.com/v1/" var CloudRunDefaultBasePath = "https://{{location}}-run.googleapis.com/" diff --git a/google-beta/resource_binary_authorization_attestor.go b/google-beta/resource_binary_authorization_attestor.go index 38d32eca9a..50b19ed611 100644 --- a/google-beta/resource_binary_authorization_attestor.go +++ b/google-beta/resource_binary_authorization_attestor.go @@ -190,16 +190,11 @@ func resourceBinaryAuthorizationAttestorCreate(d *schema.ResourceData, meta inte } else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { obj["description"] = descriptionProp } - userOwnedDrydockNoteProp, err := expandBinaryAuthorizationAttestorAttestationAuthorityNote(d.Get("attestation_authority_note"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("attestation_authority_note"); !isEmptyValue(reflect.ValueOf(userOwnedDrydockNoteProp)) && (ok || !reflect.DeepEqual(v, userOwnedDrydockNoteProp)) { - obj["userOwnedDrydockNote"] = userOwnedDrydockNoteProp - } - - obj, err = resourceBinaryAuthorizationAttestorEncoder(d, meta, obj) + userOwnedGrafeasNoteProp, err := expandBinaryAuthorizationAttestorAttestationAuthorityNote(d.Get("attestation_authority_note"), d, config) if err != nil { return err + } else if v, ok := d.GetOkExists("attestation_authority_note"); !isEmptyValue(reflect.ValueOf(userOwnedGrafeasNoteProp)) && (ok || !reflect.DeepEqual(v, userOwnedGrafeasNoteProp)) { + obj["userOwnedGrafeasNote"] = userOwnedGrafeasNoteProp } url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/attestors?attestorId={{name}}") @@ -246,18 +241,6 @@ func resourceBinaryAuthorizationAttestorRead(d *schema.ResourceData, meta interf return handleNotFoundError(err, d, fmt.Sprintf("BinaryAuthorizationAttestor %q", d.Id())) } - res, err = resourceBinaryAuthorizationAttestorDecoder(d, meta, res) - if err != nil { - return err - } - - if res == nil { - // Decoding the object has resulted in it being gone. It may be marked deleted - log.Printf("[DEBUG] Removing BinaryAuthorizationAttestor because it no longer exists.") - d.SetId("") - return nil - } - if err := d.Set("project", project); err != nil { return fmt.Errorf("Error reading Attestor: %s", err) } @@ -268,7 +251,7 @@ func resourceBinaryAuthorizationAttestorRead(d *schema.ResourceData, meta interf if err := d.Set("description", flattenBinaryAuthorizationAttestorDescription(res["description"], d)); err != nil { return fmt.Errorf("Error reading Attestor: %s", err) } - if err := d.Set("attestation_authority_note", flattenBinaryAuthorizationAttestorAttestationAuthorityNote(res["userOwnedDrydockNote"], d)); err != nil { + if err := d.Set("attestation_authority_note", flattenBinaryAuthorizationAttestorAttestationAuthorityNote(res["userOwnedGrafeasNote"], d)); err != nil { return fmt.Errorf("Error reading Attestor: %s", err) } @@ -296,16 +279,11 @@ func resourceBinaryAuthorizationAttestorUpdate(d *schema.ResourceData, meta inte } else if v, ok := d.GetOkExists("description"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { obj["description"] = descriptionProp } - userOwnedDrydockNoteProp, err := expandBinaryAuthorizationAttestorAttestationAuthorityNote(d.Get("attestation_authority_note"), d, config) - if err != nil { - return err - } else if v, ok := d.GetOkExists("attestation_authority_note"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, userOwnedDrydockNoteProp)) { - obj["userOwnedDrydockNote"] = userOwnedDrydockNoteProp - } - - obj, err = resourceBinaryAuthorizationAttestorEncoder(d, meta, obj) + userOwnedGrafeasNoteProp, err := expandBinaryAuthorizationAttestorAttestationAuthorityNote(d.Get("attestation_authority_note"), d, config) if err != nil { return err + } else if v, ok := d.GetOkExists("attestation_authority_note"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, userOwnedGrafeasNoteProp)) { + obj["userOwnedGrafeasNote"] = userOwnedGrafeasNoteProp } url, err := replaceVars(d, config, "{{BinaryAuthorizationBasePath}}projects/{{project}}/attestors/{{name}}") @@ -607,15 +585,3 @@ func expandBinaryAuthorizationAttestorAttestationAuthorityNotePublicKeysPkixPubl func expandBinaryAuthorizationAttestorAttestationAuthorityNoteDelegationServiceAccountEmail(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) { return v, nil } - -func resourceBinaryAuthorizationAttestorEncoder(d *schema.ResourceData, meta interface{}, obj map[string]interface{}) (map[string]interface{}, error) { - // encoder logic only in GA provider - - return obj, nil -} - -func resourceBinaryAuthorizationAttestorDecoder(d *schema.ResourceData, meta interface{}, res map[string]interface{}) (map[string]interface{}, error) { - // decoder logic only in GA provider - - return res, nil -} diff --git a/google-beta/resource_binary_authorization_attestor_sweeper_test.go b/google-beta/resource_binary_authorization_attestor_sweeper_test.go index 5c9b81fa98..d5b06aad81 100644 --- a/google-beta/resource_binary_authorization_attestor_sweeper_test.go +++ b/google-beta/resource_binary_authorization_attestor_sweeper_test.go @@ -56,7 +56,7 @@ func testSweepBinaryAuthorizationAttestor(region string) error { }, } - listTemplate := strings.Split("https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/attestors?attestorId={{name}}", "?")[0] + listTemplate := strings.Split("https://binaryauthorization.googleapis.com/v1/projects/{{project}}/attestors?attestorId={{name}}", "?")[0] listUrl, err := replaceVars(d, config, listTemplate) if err != nil { log.Printf("[INFO][SWEEPER_LOG] error preparing sweeper list url: %s", err) @@ -94,7 +94,7 @@ func testSweepBinaryAuthorizationAttestor(region string) error { continue } - deleteTemplate := "https://binaryauthorization.googleapis.com/v1beta1/projects/{{project}}/attestors/{{name}}" + deleteTemplate := "https://binaryauthorization.googleapis.com/v1/projects/{{project}}/attestors/{{name}}" deleteUrl, err := replaceVars(d, config, deleteTemplate) if err != nil { log.Printf("[INFO][SWEEPER_LOG] error preparing delete url: %s", err) diff --git a/google-beta/resource_sql_database_instance_test.go b/google-beta/resource_sql_database_instance_test.go index 5b99680669..b04988ac0a 100644 --- a/google-beta/resource_sql_database_instance_test.go +++ b/google-beta/resource_sql_database_instance_test.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" + sqladmin "google.golang.org/api/sqladmin/v1beta4" )