Skip to content

Add Service Networking VPC Service Controls resource. #18448

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

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/10899.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_service_networking_vpc_service_controls`
```
2 changes: 1 addition & 1 deletion google/acctest/bootstrap_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ func BootstrapSharedServiceNetworkingConnection(t *testing.T, testId string, par
}

log.Printf("[DEBUG] Waiting for service networking connection creation to finish")
if err := tpgservicenetworking.ServiceNetworkingOperationWaitTime(config, op, "Create Service Networking Connection", config.UserAgent, projectId, 4*time.Minute); err != nil {
if err := tpgservicenetworking.ServiceNetworkingOperationWaitTimeHW(config, op, "Create Service Networking Connection", config.UserAgent, projectId, 4*time.Minute); err != nil {
t.Fatalf("Error bootstrapping shared test service networking connection: %s", err)
}
}
Expand Down
2 changes: 1 addition & 1 deletion google/fwmodels/provider_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ type ProviderModel struct {
SecurityCenterManagementCustomEndpoint types.String `tfsdk:"security_center_management_custom_endpoint"`
SecuritypostureCustomEndpoint types.String `tfsdk:"securityposture_custom_endpoint"`
ServiceManagementCustomEndpoint types.String `tfsdk:"service_management_custom_endpoint"`
ServiceNetworkingCustomEndpoint types.String `tfsdk:"service_networking_custom_endpoint"`
ServiceUsageCustomEndpoint types.String `tfsdk:"service_usage_custom_endpoint"`
SourceRepoCustomEndpoint types.String `tfsdk:"source_repo_custom_endpoint"`
SpannerCustomEndpoint types.String `tfsdk:"spanner_custom_endpoint"`
Expand All @@ -153,7 +154,6 @@ type ProviderModel struct {
IamCredentialsCustomEndpoint types.String `tfsdk:"iam_credentials_custom_endpoint"`
ResourceManagerV3CustomEndpoint types.String `tfsdk:"resource_manager_v3_custom_endpoint"`
IAMCustomEndpoint types.String `tfsdk:"iam_custom_endpoint"`
ServiceNetworkingCustomEndpoint types.String `tfsdk:"service_networking_custom_endpoint"`
TagsLocationCustomEndpoint types.String `tfsdk:"tags_location_custom_endpoint"`

// dcl
Expand Down
12 changes: 6 additions & 6 deletions google/fwprovider/framework_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
transport_tpg.CustomEndpointValidator(),
},
},
"service_networking_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
transport_tpg.CustomEndpointValidator(),
},
},
"service_usage_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
Expand Down Expand Up @@ -884,12 +890,6 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
transport_tpg.CustomEndpointValidator(),
},
},
"service_networking_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
transport_tpg.CustomEndpointValidator(),
},
},
"tags_location_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 @@ -154,6 +154,7 @@ type FrameworkProviderConfig struct {
SecurityCenterManagementBasePath string
SecuritypostureBasePath string
ServiceManagementBasePath string
ServiceNetworkingBasePath string
ServiceUsageBasePath string
SourceRepoBasePath string
SpannerBasePath string
Expand Down Expand Up @@ -310,6 +311,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
p.SecurityCenterManagementBasePath = data.SecurityCenterManagementCustomEndpoint.ValueString()
p.SecuritypostureBasePath = data.SecuritypostureCustomEndpoint.ValueString()
p.ServiceManagementBasePath = data.ServiceManagementCustomEndpoint.ValueString()
p.ServiceNetworkingBasePath = data.ServiceNetworkingCustomEndpoint.ValueString()
p.ServiceUsageBasePath = data.ServiceUsageCustomEndpoint.ValueString()
p.SourceRepoBasePath = data.SourceRepoCustomEndpoint.ValueString()
p.SpannerBasePath = data.SpannerCustomEndpoint.ValueString()
Expand Down Expand Up @@ -1275,6 +1277,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
data.ServiceManagementCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.ServiceNetworkingCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_SERVICE_NETWORKING_CUSTOM_ENDPOINT",
}, transport_tpg.DefaultBasePaths[transport_tpg.ServiceNetworkingBasePathKey])
if customEndpoint != nil {
data.ServiceNetworkingCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.ServiceUsageCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_SERVICE_USAGE_CUSTOM_ENDPOINT",
Expand Down
7 changes: 6 additions & 1 deletion google/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,11 @@ func Provider() *schema.Provider {
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"service_networking_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"service_usage_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1024,6 +1029,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.SecurityCenterManagementBasePath = d.Get("security_center_management_custom_endpoint").(string)
config.SecuritypostureBasePath = d.Get("securityposture_custom_endpoint").(string)
config.ServiceManagementBasePath = d.Get("service_management_custom_endpoint").(string)
config.ServiceNetworkingBasePath = d.Get("service_networking_custom_endpoint").(string)
config.ServiceUsageBasePath = d.Get("service_usage_custom_endpoint").(string)
config.SourceRepoBasePath = d.Get("source_repo_custom_endpoint").(string)
config.SpannerBasePath = d.Get("spanner_custom_endpoint").(string)
Expand All @@ -1047,7 +1053,6 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.IamCredentialsBasePath = d.Get(transport_tpg.IamCredentialsCustomEndpointEntryKey).(string)
config.ResourceManagerV3BasePath = d.Get(transport_tpg.ResourceManagerV3CustomEndpointEntryKey).(string)
config.IAMBasePath = d.Get(transport_tpg.IAMCustomEndpointEntryKey).(string)
config.ServiceNetworkingBasePath = d.Get(transport_tpg.ServiceNetworkingCustomEndpointEntryKey).(string)
config.ServiceUsageBasePath = d.Get(transport_tpg.ServiceUsageCustomEndpointEntryKey).(string)
config.BigtableAdminBasePath = d.Get(transport_tpg.BigtableAdminCustomEndpointEntryKey).(string)
config.TagsLocationBasePath = d.Get(transport_tpg.TagsLocationCustomEndpointEntryKey).(string)
Expand Down
7 changes: 4 additions & 3 deletions google/provider/provider_mmv1_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ import (
"github.com/hashicorp/terraform-provider-google/google/services/securitycentermanagement"
"github.com/hashicorp/terraform-provider-google/google/services/securityposture"
"github.com/hashicorp/terraform-provider-google/google/services/servicemanagement"
"github.com/hashicorp/terraform-provider-google/google/services/servicenetworking"
"github.com/hashicorp/terraform-provider-google/google/services/sourcerepo"
"github.com/hashicorp/terraform-provider-google/google/services/spanner"
"github.com/hashicorp/terraform-provider-google/google/services/sql"
Expand All @@ -126,7 +127,6 @@ import (
"github.com/hashicorp/terraform-provider-google/google/services/containeraws"
"github.com/hashicorp/terraform-provider-google/google/services/containerazure"
"github.com/hashicorp/terraform-provider-google/google/services/dataflow"
"github.com/hashicorp/terraform-provider-google/google/services/servicenetworking"
"github.com/hashicorp/terraform-provider-google/google/tpgiamresource"
)

Expand Down Expand Up @@ -414,9 +414,9 @@ var handwrittenIAMDatasources = map[string]*schema.Resource{
}

// Resources
// Generated resources: 425
// Generated resources: 426
// Generated IAM resources: 249
// Total generated resources: 674
// Total generated resources: 675
var generatedResources = map[string]*schema.Resource{
"google_folder_access_approval_settings": accessapproval.ResourceAccessApprovalFolderSettings(),
"google_organization_access_approval_settings": accessapproval.ResourceAccessApprovalOrganizationSettings(),
Expand Down Expand Up @@ -1016,6 +1016,7 @@ var generatedResources = map[string]*schema.Resource{
"google_endpoints_service_consumers_iam_binding": tpgiamresource.ResourceIamBinding(servicemanagement.ServiceManagementServiceConsumersIamSchema, servicemanagement.ServiceManagementServiceConsumersIamUpdaterProducer, servicemanagement.ServiceManagementServiceConsumersIdParseFunc),
"google_endpoints_service_consumers_iam_member": tpgiamresource.ResourceIamMember(servicemanagement.ServiceManagementServiceConsumersIamSchema, servicemanagement.ServiceManagementServiceConsumersIamUpdaterProducer, servicemanagement.ServiceManagementServiceConsumersIdParseFunc),
"google_endpoints_service_consumers_iam_policy": tpgiamresource.ResourceIamPolicy(servicemanagement.ServiceManagementServiceConsumersIamSchema, servicemanagement.ServiceManagementServiceConsumersIamUpdaterProducer, servicemanagement.ServiceManagementServiceConsumersIdParseFunc),
"google_service_networking_vpc_service_controls": servicenetworking.ResourceServiceNetworkingVPCServiceControls(),
"google_sourcerepo_repository": sourcerepo.ResourceSourceRepoRepository(),
"google_sourcerepo_repository_iam_binding": tpgiamresource.ResourceIamBinding(sourcerepo.SourceRepoRepositoryIamSchema, sourcerepo.SourceRepoRepositoryIamUpdaterProducer, sourcerepo.SourceRepoRepositoryIdParseFunc),
"google_sourcerepo_repository_iam_member": tpgiamresource.ResourceIamMember(sourcerepo.SourceRepoRepositoryIamSchema, sourcerepo.SourceRepoRepositoryIamUpdaterProducer, sourcerepo.SourceRepoRepositoryIdParseFunc),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func resourceGoogleServiceNetworkingPeeredDNSDomainCreate(d *schema.ResourceData
return err
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func resourceServiceNetworkingConnectionCreate(d *schema.ResourceData, meta inte
return err
}

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

Expand Down Expand Up @@ -248,7 +248,7 @@ func resourceServiceNetworkingConnectionUpdate(d *schema.ResourceData, meta inte
if err != nil {
return err
}
if err := ServiceNetworkingOperationWaitTime(config, op, "Update Service Networking Connection", userAgent, project, d.Timeout(schema.TimeoutUpdate)); err != nil {
if err := ServiceNetworkingOperationWaitTimeHW(config, op, "Update Service Networking Connection", userAgent, project, d.Timeout(schema.TimeoutUpdate)); err != nil {
return err
}
}
Expand Down Expand Up @@ -299,7 +299,7 @@ func resourceServiceNetworkingConnectionDelete(d *schema.ResourceData, meta inte
return err
}

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

Expand Down
Loading