Skip to content

Commit 3069ab6

Browse files
add google_iam_principal_access_boundary_policy resource (#12044) (#8634)
[upstream:9c562c5132b1eb36452ea2810e416cd245532f10] Signed-off-by: Modular Magician <[email protected]>
1 parent 77ff93b commit 3069ab6

15 files changed

+1339
-2
lines changed

.changelog/12044.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
`google_iam_principal_access_boundary_policy` (beta)
3+
```

google-beta/fwmodels/provider_model.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ type ProviderModel struct {
108108
GkeonpremCustomEndpoint types.String `tfsdk:"gkeonprem_custom_endpoint"`
109109
HealthcareCustomEndpoint types.String `tfsdk:"healthcare_custom_endpoint"`
110110
IAM2CustomEndpoint types.String `tfsdk:"iam2_custom_endpoint"`
111+
IAM3CustomEndpoint types.String `tfsdk:"iam3_custom_endpoint"`
111112
IAMBetaCustomEndpoint types.String `tfsdk:"iam_beta_custom_endpoint"`
112113
IAMWorkforcePoolCustomEndpoint types.String `tfsdk:"iam_workforce_pool_custom_endpoint"`
113114
IapCustomEndpoint types.String `tfsdk:"iap_custom_endpoint"`

google-beta/fwprovider/framework_provider.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
617617
transport_tpg.CustomEndpointValidator(),
618618
},
619619
},
620+
"iam3_custom_endpoint": &schema.StringAttribute{
621+
Optional: true,
622+
Validators: []validator.String{
623+
transport_tpg.CustomEndpointValidator(),
624+
},
625+
},
620626
"iam_beta_custom_endpoint": &schema.StringAttribute{
621627
Optional: true,
622628
Validators: []validator.String{

google-beta/fwtransport/framework_config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ type FrameworkProviderConfig struct {
142142
GkeonpremBasePath string
143143
HealthcareBasePath string
144144
IAM2BasePath string
145+
IAM3BasePath string
145146
IAMBetaBasePath string
146147
IAMWorkforcePoolBasePath string
147148
IapBasePath string
@@ -322,6 +323,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
322323
p.GkeonpremBasePath = data.GkeonpremCustomEndpoint.ValueString()
323324
p.HealthcareBasePath = data.HealthcareCustomEndpoint.ValueString()
324325
p.IAM2BasePath = data.IAM2CustomEndpoint.ValueString()
326+
p.IAM3BasePath = data.IAM3CustomEndpoint.ValueString()
325327
p.IAMBetaBasePath = data.IAMBetaCustomEndpoint.ValueString()
326328
p.IAMWorkforcePoolBasePath = data.IAMWorkforcePoolCustomEndpoint.ValueString()
327329
p.IapBasePath = data.IapCustomEndpoint.ValueString()
@@ -1149,6 +1151,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
11491151
data.IAM2CustomEndpoint = types.StringValue(customEndpoint.(string))
11501152
}
11511153
}
1154+
if data.IAM3CustomEndpoint.IsNull() {
1155+
customEndpoint := transport_tpg.MultiEnvDefault([]string{
1156+
"GOOGLE_IAM3_CUSTOM_ENDPOINT",
1157+
}, transport_tpg.DefaultBasePaths[transport_tpg.IAM3BasePathKey])
1158+
if customEndpoint != nil {
1159+
data.IAM3CustomEndpoint = types.StringValue(customEndpoint.(string))
1160+
}
1161+
}
11521162
if data.IAMBetaCustomEndpoint.IsNull() {
11531163
customEndpoint := transport_tpg.MultiEnvDefault([]string{
11541164
"GOOGLE_IAM_BETA_CUSTOM_ENDPOINT",

google-beta/provider/provider.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,11 @@ func Provider() *schema.Provider {
535535
Optional: true,
536536
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
537537
},
538+
"iam3_custom_endpoint": {
539+
Type: schema.TypeString,
540+
Optional: true,
541+
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
542+
},
538543
"iam_beta_custom_endpoint": {
539544
Type: schema.TypeString,
540545
Optional: true,
@@ -1120,6 +1125,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
11201125
config.GkeonpremBasePath = d.Get("gkeonprem_custom_endpoint").(string)
11211126
config.HealthcareBasePath = d.Get("healthcare_custom_endpoint").(string)
11221127
config.IAM2BasePath = d.Get("iam2_custom_endpoint").(string)
1128+
config.IAM3BasePath = d.Get("iam3_custom_endpoint").(string)
11231129
config.IAMBetaBasePath = d.Get("iam_beta_custom_endpoint").(string)
11241130
config.IAMWorkforcePoolBasePath = d.Get("iam_workforce_pool_custom_endpoint").(string)
11251131
config.IapBasePath = d.Get("iap_custom_endpoint").(string)

google-beta/provider/provider_mmv1_resources.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ import (
8282
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/gkeonprem"
8383
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/healthcare"
8484
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/iam2"
85+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/iam3"
8586
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/iambeta"
8687
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/iamworkforcepool"
8788
"github.com/hashicorp/terraform-provider-google-beta/google-beta/services/iap"
@@ -502,9 +503,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
502503
}
503504

504505
// Resources
505-
// Generated resources: 552
506+
// Generated resources: 553
506507
// Generated IAM resources: 291
507-
// Total generated resources: 843
508+
// Total generated resources: 844
508509
var generatedResources = map[string]*schema.Resource{
509510
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
510511
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
@@ -1012,6 +1013,7 @@ var generatedResources = map[string]*schema.Resource{
10121013
"google_healthcare_workspace": healthcare.ResourceHealthcareWorkspace(),
10131014
"google_iam_access_boundary_policy": iam2.ResourceIAM2AccessBoundaryPolicy(),
10141015
"google_iam_deny_policy": iam2.ResourceIAM2DenyPolicy(),
1016+
"google_iam_principal_access_boundary_policy": iam3.ResourceIAM3PrincipalAccessBoundaryPolicy(),
10151017
"google_iam_workload_identity_pool": iambeta.ResourceIAMBetaWorkloadIdentityPool(),
10161018
"google_iam_workload_identity_pool_provider": iambeta.ResourceIAMBetaWorkloadIdentityPoolProvider(),
10171019
"google_iam_workforce_pool": iamworkforcepool.ResourceIAMWorkforcePoolWorkforcePool(),
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// Copyright (c) HashiCorp, Inc.
2+
// SPDX-License-Identifier: MPL-2.0
3+
4+
// ----------------------------------------------------------------------------
5+
//
6+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
7+
//
8+
// ----------------------------------------------------------------------------
9+
//
10+
// This file is automatically generated by Magic Modules and manual
11+
// changes will be clobbered when the file is regenerated.
12+
//
13+
// Please read more about how to change this file in
14+
// .github/CONTRIBUTING.md.
15+
//
16+
// ----------------------------------------------------------------------------
17+
18+
package iam3
19+
20+
import (
21+
"encoding/json"
22+
"errors"
23+
"fmt"
24+
"time"
25+
26+
"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
27+
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
28+
)
29+
30+
type IAM3OperationWaiter struct {
31+
Config *transport_tpg.Config
32+
UserAgent string
33+
tpgresource.CommonOperationWaiter
34+
}
35+
36+
func (w *IAM3OperationWaiter) QueryOp() (interface{}, error) {
37+
if w == nil {
38+
return nil, fmt.Errorf("Cannot query operation, it's unset or nil.")
39+
}
40+
// Returns the proper get.
41+
url := fmt.Sprintf("%s%s", w.Config.IAM3BasePath, w.CommonOperationWaiter.Op.Name)
42+
43+
return transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
44+
Config: w.Config,
45+
Method: "GET",
46+
RawURL: url,
47+
UserAgent: w.UserAgent,
48+
})
49+
}
50+
51+
func createIAM3Waiter(config *transport_tpg.Config, op map[string]interface{}, activity, userAgent string) (*IAM3OperationWaiter, error) {
52+
w := &IAM3OperationWaiter{
53+
Config: config,
54+
UserAgent: userAgent,
55+
}
56+
if err := w.CommonOperationWaiter.SetOp(op); err != nil {
57+
return nil, err
58+
}
59+
return w, nil
60+
}
61+
62+
// nolint: deadcode,unused
63+
func IAM3OperationWaitTimeWithResponse(config *transport_tpg.Config, op map[string]interface{}, response *map[string]interface{}, activity, userAgent string, timeout time.Duration) error {
64+
w, err := createIAM3Waiter(config, op, activity, userAgent)
65+
if err != nil {
66+
return err
67+
}
68+
if err := tpgresource.OperationWait(w, activity, timeout, config.PollInterval); err != nil {
69+
return err
70+
}
71+
rawResponse := []byte(w.CommonOperationWaiter.Op.Response)
72+
if len(rawResponse) == 0 {
73+
return errors.New("`resource` not set in operation response")
74+
}
75+
return json.Unmarshal(rawResponse, response)
76+
}
77+
78+
func IAM3OperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, activity, userAgent string, timeout time.Duration) error {
79+
if val, ok := op["name"]; !ok || val == "" {
80+
// This was a synchronous call - there is no operation to wait for.
81+
return nil
82+
}
83+
w, err := createIAM3Waiter(config, op, activity, userAgent)
84+
if err != nil {
85+
// If w is nil, the op was synchronous.
86+
return err
87+
}
88+
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
89+
}

0 commit comments

Comments
 (0)