Skip to content

Commit 96204d0

Browse files
Add Service Networking VPC Service Controls resource. (#10899) (#18448)
[upstream:e463dfa4d6b6b1802f5ce9deb54f3868b15a0c9f] Signed-off-by: Modular Magician <magic-modules@google.com>
1 parent 6254c4e commit 96204d0

17 files changed

+744
-33
lines changed

.changelog/10899.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_service_networking_vpc_service_controls`
3+
```

google/acctest/bootstrap_test_utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ func BootstrapSharedServiceNetworkingConnection(t *testing.T, testId string, par
553553
}
554554

555555
log.Printf("[DEBUG] Waiting for service networking connection creation to finish")
556-
if err := tpgservicenetworking.ServiceNetworkingOperationWaitTime(config, op, "Create Service Networking Connection", config.UserAgent, projectId, 4*time.Minute); err != nil {
556+
if err := tpgservicenetworking.ServiceNetworkingOperationWaitTimeHW(config, op, "Create Service Networking Connection", config.UserAgent, projectId, 4*time.Minute); err != nil {
557557
t.Fatalf("Error bootstrapping shared test service networking connection: %s", err)
558558
}
559559
}

google/fwmodels/provider_model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ type ProviderModel struct {
131131
SecurityCenterManagementCustomEndpoint types.String `tfsdk:"security_center_management_custom_endpoint"`
132132
SecuritypostureCustomEndpoint types.String `tfsdk:"securityposture_custom_endpoint"`
133133
ServiceManagementCustomEndpoint types.String `tfsdk:"service_management_custom_endpoint"`
134+
ServiceNetworkingCustomEndpoint types.String `tfsdk:"service_networking_custom_endpoint"`
134135
ServiceUsageCustomEndpoint types.String `tfsdk:"service_usage_custom_endpoint"`
135136
SourceRepoCustomEndpoint types.String `tfsdk:"source_repo_custom_endpoint"`
136137
SpannerCustomEndpoint types.String `tfsdk:"spanner_custom_endpoint"`
@@ -153,7 +154,6 @@ type ProviderModel struct {
153154
IamCredentialsCustomEndpoint types.String `tfsdk:"iam_credentials_custom_endpoint"`
154155
ResourceManagerV3CustomEndpoint types.String `tfsdk:"resource_manager_v3_custom_endpoint"`
155156
IAMCustomEndpoint types.String `tfsdk:"iam_custom_endpoint"`
156-
ServiceNetworkingCustomEndpoint types.String `tfsdk:"service_networking_custom_endpoint"`
157157
TagsLocationCustomEndpoint types.String `tfsdk:"tags_location_custom_endpoint"`
158158

159159
// dcl

google/fwprovider/framework_provider.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
762762
transport_tpg.CustomEndpointValidator(),
763763
},
764764
},
765+
"service_networking_custom_endpoint": &schema.StringAttribute{
766+
Optional: true,
767+
Validators: []validator.String{
768+
transport_tpg.CustomEndpointValidator(),
769+
},
770+
},
765771
"service_usage_custom_endpoint": &schema.StringAttribute{
766772
Optional: true,
767773
Validators: []validator.String{
@@ -884,12 +890,6 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
884890
transport_tpg.CustomEndpointValidator(),
885891
},
886892
},
887-
"service_networking_custom_endpoint": &schema.StringAttribute{
888-
Optional: true,
889-
Validators: []validator.String{
890-
transport_tpg.CustomEndpointValidator(),
891-
},
892-
},
893893
"tags_location_custom_endpoint": &schema.StringAttribute{
894894
Optional: true,
895895
Validators: []validator.String{

google/fwtransport/framework_config.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ type FrameworkProviderConfig struct {
154154
SecurityCenterManagementBasePath string
155155
SecuritypostureBasePath string
156156
ServiceManagementBasePath string
157+
ServiceNetworkingBasePath string
157158
ServiceUsageBasePath string
158159
SourceRepoBasePath string
159160
SpannerBasePath string
@@ -310,6 +311,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
310311
p.SecurityCenterManagementBasePath = data.SecurityCenterManagementCustomEndpoint.ValueString()
311312
p.SecuritypostureBasePath = data.SecuritypostureCustomEndpoint.ValueString()
312313
p.ServiceManagementBasePath = data.ServiceManagementCustomEndpoint.ValueString()
314+
p.ServiceNetworkingBasePath = data.ServiceNetworkingCustomEndpoint.ValueString()
313315
p.ServiceUsageBasePath = data.ServiceUsageCustomEndpoint.ValueString()
314316
p.SourceRepoBasePath = data.SourceRepoCustomEndpoint.ValueString()
315317
p.SpannerBasePath = data.SpannerCustomEndpoint.ValueString()
@@ -1275,6 +1277,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
12751277
data.ServiceManagementCustomEndpoint = types.StringValue(customEndpoint.(string))
12761278
}
12771279
}
1280+
if data.ServiceNetworkingCustomEndpoint.IsNull() {
1281+
customEndpoint := transport_tpg.MultiEnvDefault([]string{
1282+
"GOOGLE_SERVICE_NETWORKING_CUSTOM_ENDPOINT",
1283+
}, transport_tpg.DefaultBasePaths[transport_tpg.ServiceNetworkingBasePathKey])
1284+
if customEndpoint != nil {
1285+
data.ServiceNetworkingCustomEndpoint = types.StringValue(customEndpoint.(string))
1286+
}
1287+
}
12781288
if data.ServiceUsageCustomEndpoint.IsNull() {
12791289
customEndpoint := transport_tpg.MultiEnvDefault([]string{
12801290
"GOOGLE_SERVICE_USAGE_CUSTOM_ENDPOINT",

google/provider/provider.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,11 @@ func Provider() *schema.Provider {
659659
Optional: true,
660660
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
661661
},
662+
"service_networking_custom_endpoint": {
663+
Type: schema.TypeString,
664+
Optional: true,
665+
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
666+
},
662667
"service_usage_custom_endpoint": {
663668
Type: schema.TypeString,
664669
Optional: true,
@@ -1024,6 +1029,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
10241029
config.SecurityCenterManagementBasePath = d.Get("security_center_management_custom_endpoint").(string)
10251030
config.SecuritypostureBasePath = d.Get("securityposture_custom_endpoint").(string)
10261031
config.ServiceManagementBasePath = d.Get("service_management_custom_endpoint").(string)
1032+
config.ServiceNetworkingBasePath = d.Get("service_networking_custom_endpoint").(string)
10271033
config.ServiceUsageBasePath = d.Get("service_usage_custom_endpoint").(string)
10281034
config.SourceRepoBasePath = d.Get("source_repo_custom_endpoint").(string)
10291035
config.SpannerBasePath = d.Get("spanner_custom_endpoint").(string)
@@ -1047,7 +1053,6 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
10471053
config.IamCredentialsBasePath = d.Get(transport_tpg.IamCredentialsCustomEndpointEntryKey).(string)
10481054
config.ResourceManagerV3BasePath = d.Get(transport_tpg.ResourceManagerV3CustomEndpointEntryKey).(string)
10491055
config.IAMBasePath = d.Get(transport_tpg.IAMCustomEndpointEntryKey).(string)
1050-
config.ServiceNetworkingBasePath = d.Get(transport_tpg.ServiceNetworkingCustomEndpointEntryKey).(string)
10511056
config.ServiceUsageBasePath = d.Get(transport_tpg.ServiceUsageCustomEndpointEntryKey).(string)
10521057
config.BigtableAdminBasePath = d.Get(transport_tpg.BigtableAdminCustomEndpointEntryKey).(string)
10531058
config.TagsLocationBasePath = d.Get(transport_tpg.TagsLocationCustomEndpointEntryKey).(string)

google/provider/provider_mmv1_resources.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ import (
107107
"github.com/hashicorp/terraform-provider-google/google/services/securitycentermanagement"
108108
"github.com/hashicorp/terraform-provider-google/google/services/securityposture"
109109
"github.com/hashicorp/terraform-provider-google/google/services/servicemanagement"
110+
"github.com/hashicorp/terraform-provider-google/google/services/servicenetworking"
110111
"github.com/hashicorp/terraform-provider-google/google/services/sourcerepo"
111112
"github.com/hashicorp/terraform-provider-google/google/services/spanner"
112113
"github.com/hashicorp/terraform-provider-google/google/services/sql"
@@ -126,7 +127,6 @@ import (
126127
"github.com/hashicorp/terraform-provider-google/google/services/containeraws"
127128
"github.com/hashicorp/terraform-provider-google/google/services/containerazure"
128129
"github.com/hashicorp/terraform-provider-google/google/services/dataflow"
129-
"github.com/hashicorp/terraform-provider-google/google/services/servicenetworking"
130130
"github.com/hashicorp/terraform-provider-google/google/tpgiamresource"
131131
)
132132

@@ -414,9 +414,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
414414
}
415415

416416
// Resources
417-
// Generated resources: 425
417+
// Generated resources: 426
418418
// Generated IAM resources: 249
419-
// Total generated resources: 674
419+
// Total generated resources: 675
420420
var generatedResources = map[string]*schema.Resource{
421421
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
422422
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
@@ -1016,6 +1016,7 @@ var generatedResources = map[string]*schema.Resource{
10161016
"google_endpoints_service_consumers_iam_binding": tpgiamresource.ResourceIamBinding(servicemanagement.ServiceManagementServiceConsumersIamSchema, servicemanagement.ServiceManagementServiceConsumersIamUpdaterProducer, servicemanagement.ServiceManagementServiceConsumersIdParseFunc),
10171017
"google_endpoints_service_consumers_iam_member": tpgiamresource.ResourceIamMember(servicemanagement.ServiceManagementServiceConsumersIamSchema, servicemanagement.ServiceManagementServiceConsumersIamUpdaterProducer, servicemanagement.ServiceManagementServiceConsumersIdParseFunc),
10181018
"google_endpoints_service_consumers_iam_policy": tpgiamresource.ResourceIamPolicy(servicemanagement.ServiceManagementServiceConsumersIamSchema, servicemanagement.ServiceManagementServiceConsumersIamUpdaterProducer, servicemanagement.ServiceManagementServiceConsumersIdParseFunc),
1019+
"google_service_networking_vpc_service_controls": servicenetworking.ResourceServiceNetworkingVPCServiceControls(),
10191020
"google_sourcerepo_repository": sourcerepo.ResourceSourceRepoRepository(),
10201021
"google_sourcerepo_repository_iam_binding": tpgiamresource.ResourceIamBinding(sourcerepo.SourceRepoRepositoryIamSchema, sourcerepo.SourceRepoRepositoryIamUpdaterProducer, sourcerepo.SourceRepoRepositoryIdParseFunc),
10211022
"google_sourcerepo_repository_iam_member": tpgiamresource.ResourceIamMember(sourcerepo.SourceRepoRepositoryIamSchema, sourcerepo.SourceRepoRepositoryIamUpdaterProducer, sourcerepo.SourceRepoRepositoryIdParseFunc),

google/services/servicenetworking/resource_google_service_networking_peered_dns_domain.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ func resourceGoogleServiceNetworkingPeeredDNSDomainCreate(d *schema.ResourceData
137137
return err
138138
}
139139

140-
if err := ServiceNetworkingOperationWaitTime(config, op, "Create Service Networking Peered DNS Domain", userAgent, project, d.Timeout(schema.TimeoutCreate)); err != nil {
140+
if err := ServiceNetworkingOperationWaitTimeHW(config, op, "Create Service Networking Peered DNS Domain", userAgent, project, d.Timeout(schema.TimeoutCreate)); err != nil {
141141
return err
142142
}
143143

google/services/servicenetworking/resource_service_networking_connection.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func resourceServiceNetworkingConnectionCreate(d *schema.ResourceData, meta inte
119119
return err
120120
}
121121

122-
if err := ServiceNetworkingOperationWaitTime(config, op, "Create Service Networking Connection", userAgent, project, d.Timeout(schema.TimeoutCreate)); err != nil {
122+
if err := ServiceNetworkingOperationWaitTimeHW(config, op, "Create Service Networking Connection", userAgent, project, d.Timeout(schema.TimeoutCreate)); err != nil {
123123
return err
124124
}
125125

@@ -248,7 +248,7 @@ func resourceServiceNetworkingConnectionUpdate(d *schema.ResourceData, meta inte
248248
if err != nil {
249249
return err
250250
}
251-
if err := ServiceNetworkingOperationWaitTime(config, op, "Update Service Networking Connection", userAgent, project, d.Timeout(schema.TimeoutUpdate)); err != nil {
251+
if err := ServiceNetworkingOperationWaitTimeHW(config, op, "Update Service Networking Connection", userAgent, project, d.Timeout(schema.TimeoutUpdate)); err != nil {
252252
return err
253253
}
254254
}
@@ -299,7 +299,7 @@ func resourceServiceNetworkingConnectionDelete(d *schema.ResourceData, meta inte
299299
return err
300300
}
301301

302-
if err := ServiceNetworkingOperationWaitTime(config, op, "Delete Service Networking Connection", userAgent, project, d.Timeout(schema.TimeoutCreate)); err != nil {
302+
if err := ServiceNetworkingOperationWaitTimeHW(config, op, "Delete Service Networking Connection", userAgent, project, d.Timeout(schema.TimeoutCreate)); err != nil {
303303
return errwrap.Wrapf("Unable to remove Service Networking Connection, err: {{err}}", err)
304304
}
305305

0 commit comments

Comments
 (0)