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

promote resource privileged_access_manager_entitlement to ga #18686

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/11094.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
privilegedaccessmanager: promoted `google_privileged_access_manager_entitlement` resource from beta to ga
```
1 change: 1 addition & 0 deletions google/fwmodels/provider_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ type ProviderModel struct {
OSConfigCustomEndpoint types.String `tfsdk:"os_config_custom_endpoint"`
OSLoginCustomEndpoint types.String `tfsdk:"os_login_custom_endpoint"`
PrivatecaCustomEndpoint types.String `tfsdk:"privateca_custom_endpoint"`
PrivilegedAccessManagerCustomEndpoint types.String `tfsdk:"privileged_access_manager_custom_endpoint"`
PublicCACustomEndpoint types.String `tfsdk:"public_ca_custom_endpoint"`
PubsubCustomEndpoint types.String `tfsdk:"pubsub_custom_endpoint"`
PubsubLiteCustomEndpoint types.String `tfsdk:"pubsub_lite_custom_endpoint"`
Expand Down
6 changes: 6 additions & 0 deletions google/fwprovider/framework_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
transport_tpg.CustomEndpointValidator(),
},
},
"privileged_access_manager_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
transport_tpg.CustomEndpointValidator(),
},
},
"public_ca_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
Expand Down
10 changes: 10 additions & 0 deletions google/fwtransport/framework_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ type FrameworkProviderConfig struct {
OSConfigBasePath string
OSLoginBasePath string
PrivatecaBasePath string
PrivilegedAccessManagerBasePath string
PublicCABasePath string
PubsubBasePath string
PubsubLiteBasePath string
Expand Down Expand Up @@ -301,6 +302,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
p.OSConfigBasePath = data.OSConfigCustomEndpoint.ValueString()
p.OSLoginBasePath = data.OSLoginCustomEndpoint.ValueString()
p.PrivatecaBasePath = data.PrivatecaCustomEndpoint.ValueString()
p.PrivilegedAccessManagerBasePath = data.PrivilegedAccessManagerCustomEndpoint.ValueString()
p.PublicCABasePath = data.PublicCACustomEndpoint.ValueString()
p.PubsubBasePath = data.PubsubCustomEndpoint.ValueString()
p.PubsubLiteBasePath = data.PubsubLiteCustomEndpoint.ValueString()
Expand Down Expand Up @@ -1191,6 +1193,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
data.PrivatecaCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.PrivilegedAccessManagerCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_PRIVILEGED_ACCESS_MANAGER_CUSTOM_ENDPOINT",
}, transport_tpg.DefaultBasePaths[transport_tpg.PrivilegedAccessManagerBasePathKey])
if customEndpoint != nil {
data.PrivilegedAccessManagerCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.PublicCACustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_PUBLIC_CA_CUSTOM_ENDPOINT",
Expand Down
6 changes: 6 additions & 0 deletions google/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,11 @@ func Provider() *schema.Provider {
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"privileged_access_manager_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"public_ca_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1023,6 +1028,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.OSConfigBasePath = d.Get("os_config_custom_endpoint").(string)
config.OSLoginBasePath = d.Get("os_login_custom_endpoint").(string)
config.PrivatecaBasePath = d.Get("privateca_custom_endpoint").(string)
config.PrivilegedAccessManagerBasePath = d.Get("privileged_access_manager_custom_endpoint").(string)
config.PublicCABasePath = d.Get("public_ca_custom_endpoint").(string)
config.PubsubBasePath = d.Get("pubsub_custom_endpoint").(string)
config.PubsubLiteBasePath = d.Get("pubsub_lite_custom_endpoint").(string)
Expand Down
6 changes: 4 additions & 2 deletions google/provider/provider_mmv1_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ import (
"github.com/hashicorp/terraform-provider-google/google/services/osconfig"
"github.com/hashicorp/terraform-provider-google/google/services/oslogin"
"github.com/hashicorp/terraform-provider-google/google/services/privateca"
"github.com/hashicorp/terraform-provider-google/google/services/privilegedaccessmanager"
"github.com/hashicorp/terraform-provider-google/google/services/publicca"
"github.com/hashicorp/terraform-provider-google/google/services/pubsub"
"github.com/hashicorp/terraform-provider-google/google/services/pubsublite"
Expand Down Expand Up @@ -420,9 +421,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
}

// Resources
// Generated resources: 433
// Generated resources: 434
// Generated IAM resources: 252
// Total generated resources: 685
// Total generated resources: 686
var generatedResources = map[string]*schema.Resource{
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
Expand Down Expand Up @@ -978,6 +979,7 @@ var generatedResources = map[string]*schema.Resource{
"google_privateca_certificate_template_iam_binding": tpgiamresource.ResourceIamBinding(privateca.PrivatecaCertificateTemplateIamSchema, privateca.PrivatecaCertificateTemplateIamUpdaterProducer, privateca.PrivatecaCertificateTemplateIdParseFunc),
"google_privateca_certificate_template_iam_member": tpgiamresource.ResourceIamMember(privateca.PrivatecaCertificateTemplateIamSchema, privateca.PrivatecaCertificateTemplateIamUpdaterProducer, privateca.PrivatecaCertificateTemplateIdParseFunc),
"google_privateca_certificate_template_iam_policy": tpgiamresource.ResourceIamPolicy(privateca.PrivatecaCertificateTemplateIamSchema, privateca.PrivatecaCertificateTemplateIamUpdaterProducer, privateca.PrivatecaCertificateTemplateIdParseFunc),
"google_privileged_access_manager_entitlement": privilegedaccessmanager.ResourcePrivilegedAccessManagerEntitlement(),
"google_public_ca_external_account_key": publicca.ResourcePublicCAExternalAccountKey(),
"google_pubsub_schema": pubsub.ResourcePubsubSchema(),
"google_pubsub_schema_iam_binding": tpgiamresource.ResourceIamBinding(pubsub.PubsubSchemaIamSchema, pubsub.PubsubSchemaIamUpdaterProducer, pubsub.PubsubSchemaIdParseFunc),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// ----------------------------------------------------------------------------
//
// *** 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.
//
// ----------------------------------------------------------------------------

package privilegedaccessmanager

import (
"encoding/json"
"errors"
"fmt"
"time"

"github.com/hashicorp/terraform-provider-google/google/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
)

type PrivilegedAccessManagerOperationWaiter struct {
Config *transport_tpg.Config
UserAgent string
tpgresource.CommonOperationWaiter
}

func (w *PrivilegedAccessManagerOperationWaiter) QueryOp() (interface{}, error) {
if w == nil {
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
}
// Returns the proper get.
url := fmt.Sprintf("%s%s", w.Config.PrivilegedAccessManagerBasePath, w.CommonOperationWaiter.Op.Name)

return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Config: w.Config,
Method: "GET",
RawURL: url,
UserAgent: w.UserAgent,
})
}

func createPrivilegedAccessManagerWaiter(config *transport_tpg.Config, op map[string]interface{}, activity, userAgent string) (*PrivilegedAccessManagerOperationWaiter, error) {
w := &PrivilegedAccessManagerOperationWaiter{
Config: config,
UserAgent: userAgent,
}
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
return nil, err
}
return w, nil
}

// nolint: deadcode,unused
func PrivilegedAccessManagerOperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, activity, userAgent string, timeout time.Duration) error {
w, err := createPrivilegedAccessManagerWaiter(config, op, activity, userAgent)
if err != nil {
return err
}
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
return err
}
rawResponse := []byte(w.CommonOperationWaiter.Op.Response)
if len(rawResponse) == 0 {
return errors.New("`resource` not set in operation response")
}
return json.Unmarshal(rawResponse, response)
}

func PrivilegedAccessManagerOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, activity, userAgent string, timeout time.Duration) error {
if val, ok := op["name"]; !ok || val == "" {
// This was a synchronous call - there is no operation to wait for.
return nil
}
w, err := createPrivilegedAccessManagerWaiter(config, op, activity, userAgent)
if err != nil {
// If w is nil, the op was synchronous.
return err
}
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
}
Loading