Skip to content

Commit d0dc894

Browse files
modular-magicianshuyama1
authored andcommitted
Revert "Implement low-touch tpgtools integration." (#6121) (#4384)
Signed-off-by: Modular Magician <[email protected]>
1 parent c6e82bf commit d0dc894

File tree

5 files changed

+172
-54
lines changed

5 files changed

+172
-54
lines changed

.changelog/6121.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
```release-note:none
2+
```

google-beta/config.go

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error) {
137137
// Config is the configuration structure used to instantiate the Google
138138
// provider.
139139
type Config struct {
140-
DCLConfig
141140
AccessToken string
142141
Credentials string
143142
ImpersonateServiceAccount string
@@ -253,12 +252,26 @@ type Config struct {
253252
StorageTransferBasePath string
254253
BigtableAdminBasePath string
255254

256-
// dcl
257-
ContainerAwsBasePath string
258-
ContainerAzureBasePath string
259-
260255
requestBatcherServiceUsage *RequestBatcher
261256
requestBatcherIam *RequestBatcher
257+
258+
// start DCLBasePaths
259+
// dataprocBasePath is implemented in mm
260+
AssuredWorkloadsBasePath string
261+
ClouddeployBasePath string
262+
CloudResourceManagerBasePath string
263+
ContainerAwsBasePath string
264+
ContainerAzureBasePath string
265+
DataplexBasePath string
266+
EventarcBasePath string
267+
FirebaserulesBasePath string
268+
GkeHubBasePath string
269+
NetworkConnectivityBasePath string
270+
OrgPolicyBasePath string
271+
RecaptchaEnterpriseBasePath string
272+
ApikeysBasePath string
273+
// CloudBuild WorkerPool uses a different endpoint (v1beta1) than any other CloudBuild resources
274+
CloudBuildWorkerPoolBasePath string
262275
}
263276

264277
const AccessApprovalBasePathKey = "AccessApproval"

google-beta/provider.go

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -789,8 +789,22 @@ func Provider() *schema.Provider {
789789
BigtableAdminCustomEndpointEntryKey: BigtableAdminCustomEndpointEntry,
790790

791791
// dcl
792-
ContainerAwsCustomEndpointEntryKey: ContainerAwsCustomEndpointEntry,
793-
ContainerAzureCustomEndpointEntryKey: ContainerAzureCustomEndpointEntry,
792+
AssuredWorkloadsEndpointEntryKey: AssuredWorkloadsEndpointEntry,
793+
ClouddeployEndpointEntryKey: ClouddeployEndpointEntry,
794+
CloudResourceManagerEndpointEntryKey: CloudResourceManagerEndpointEntry,
795+
DataplexEndpointEntryKey: DataplexEndpointEntry,
796+
EventarcEndpointEntryKey: EventarcEndpointEntry,
797+
FirebaserulesEndpointEntryKey: FirebaserulesEndpointEntry,
798+
GkeHubFeatureCustomEndpointEntryKey: GkeHubFeatureCustomEndpointEntry,
799+
NetworkConnectivityEndpointEntryKey: NetworkConnectivityEndpointEntry,
800+
OrgPolicyEndpointEntryKey: OrgPolicyEndpointEntry,
801+
PrivatecaCertificateTemplateEndpointEntryKey: PrivatecaCertificateTemplateCustomEndpointEntry,
802+
RecaptchaEnterpriseEndpointEntryKey: RecaptchaEnterpriseEndpointEntry,
803+
ContainerAwsCustomEndpointEntryKey: ContainerAwsCustomEndpointEntry,
804+
ContainerAzureCustomEndpointEntryKey: ContainerAzureCustomEndpointEntry,
805+
ApikeysEndpointEntryKey: ApikeysEndpointEntry,
806+
807+
CloudBuildWorkerPoolEndpointEntryKey: CloudBuildWorkerPoolEndpointEntry,
794808
},
795809

796810
ProviderMetaSchema: map[string]*schema.Schema{
@@ -922,8 +936,6 @@ func Provider() *schema.Provider {
922936
return providerConfigure(ctx, d, provider)
923937
}
924938

925-
configureDCLProvider(provider)
926-
927939
return provider
928940
}
929941

@@ -1679,8 +1691,20 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
16791691
config.BigtableAdminBasePath = d.Get(BigtableAdminCustomEndpointEntryKey).(string)
16801692

16811693
// dcl
1694+
config.ApikeysBasePath = d.Get(ApikeysEndpointEntryKey).(string)
1695+
config.AssuredWorkloadsBasePath = d.Get(AssuredWorkloadsEndpointEntryKey).(string)
1696+
config.ClouddeployBasePath = d.Get(ClouddeployEndpointEntryKey).(string)
1697+
config.CloudResourceManagerBasePath = d.Get(CloudResourceManagerEndpointEntryKey).(string)
1698+
config.DataplexBasePath = d.Get(DataplexEndpointEntryKey).(string)
1699+
config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
1700+
config.FirebaserulesBasePath = d.Get(FirebaserulesEndpointEntryKey).(string)
1701+
config.GkeHubBasePath = d.Get(GkeHubFeatureCustomEndpointEntryKey).(string)
1702+
config.NetworkConnectivityBasePath = d.Get(NetworkConnectivityEndpointEntryKey).(string)
1703+
config.OrgPolicyBasePath = d.Get(OrgPolicyEndpointEntryKey).(string)
1704+
config.PrivatecaBasePath = d.Get(PrivatecaCertificateTemplateEndpointEntryKey).(string)
16821705
config.ContainerAwsBasePath = d.Get(ContainerAwsCustomEndpointEntryKey).(string)
16831706
config.ContainerAzureBasePath = d.Get(ContainerAzureCustomEndpointEntryKey).(string)
1707+
config.CloudBuildWorkerPoolBasePath = d.Get(CloudBuildWorkerPoolEndpointEntryKey).(string)
16841708

16851709
stopCtx, ok := schema.StopContext(ctx)
16861710
if !ok {
@@ -1690,7 +1714,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
16901714
return nil, diag.FromErr(err)
16911715
}
16921716

1693-
return providerDCLConfigure(d, &config), nil
1717+
return &config, nil
16941718
}
16951719

16961720
func validateCredentials(v interface{}, k string) (warnings []string, errors []error) {

google-beta/provider_dcl_client_creation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ func NewDCLGkeHubClient(config *Config, userAgent, billingProject string, timeou
346346
dcl.WithHTTPClient(config.client),
347347
dcl.WithUserAgent(userAgent),
348348
dcl.WithLogger(dclLogger{}),
349-
dcl.WithBasePath(config.GKEHubBasePath),
349+
dcl.WithBasePath(config.GkeHubBasePath),
350350
}
351351

352352
if timeout != 0 {

google-beta/provider_dcl_endpoints.go

Lines changed: 122 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,33 @@ var CloudResourceManagerEndpointEntry = &schema.Schema{
6767
}, ""),
6868
}
6969

70+
var ComputeEndpointEntryKey = "compute_custom_endpoint"
71+
var ComputeEndpointEntry = &schema.Schema{
72+
Type: schema.TypeString,
73+
Optional: true,
74+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
75+
"GOOGLE_COMPUTE_CUSTOM_ENDPOINT",
76+
}, ""),
77+
}
78+
79+
var ContainerAwsEndpointEntryKey = "container_aws_custom_endpoint"
80+
var ContainerAwsEndpointEntry = &schema.Schema{
81+
Type: schema.TypeString,
82+
Optional: true,
83+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
84+
"GOOGLE_CONTAINER_AWS_CUSTOM_ENDPOINT",
85+
}, ""),
86+
}
87+
88+
var ContainerAzureEndpointEntryKey = "container_azure_custom_endpoint"
89+
var ContainerAzureEndpointEntry = &schema.Schema{
90+
Type: schema.TypeString,
91+
Optional: true,
92+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
93+
"GOOGLE_CONTAINER_AZURE_CUSTOM_ENDPOINT",
94+
}, ""),
95+
}
96+
7097
var DataplexEndpointEntryKey = "dataplex_custom_endpoint"
7198
var DataplexEndpointEntry = &schema.Schema{
7299
Type: schema.TypeString,
@@ -94,6 +121,24 @@ var FirebaserulesEndpointEntry = &schema.Schema{
94121
}, ""),
95122
}
96123

124+
var LoggingEndpointEntryKey = "logging_custom_endpoint"
125+
var LoggingEndpointEntry = &schema.Schema{
126+
Type: schema.TypeString,
127+
Optional: true,
128+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
129+
"GOOGLE_LOGGING_CUSTOM_ENDPOINT",
130+
}, ""),
131+
}
132+
133+
var MonitoringEndpointEntryKey = "monitoring_custom_endpoint"
134+
var MonitoringEndpointEntry = &schema.Schema{
135+
Type: schema.TypeString,
136+
Optional: true,
137+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
138+
"GOOGLE_MONITORING_CUSTOM_ENDPOINT",
139+
}, ""),
140+
}
141+
97142
var NetworkConnectivityEndpointEntryKey = "network_connectivity_custom_endpoint"
98143
var NetworkConnectivityEndpointEntry = &schema.Schema{
99144
Type: schema.TypeString,
@@ -112,6 +157,24 @@ var OrgPolicyEndpointEntry = &schema.Schema{
112157
}, ""),
113158
}
114159

160+
var OSConfigEndpointEntryKey = "os_config_custom_endpoint"
161+
var OSConfigEndpointEntry = &schema.Schema{
162+
Type: schema.TypeString,
163+
Optional: true,
164+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
165+
"GOOGLE_OS_CONFIG_CUSTOM_ENDPOINT",
166+
}, ""),
167+
}
168+
169+
var PrivatecaEndpointEntryKey = "privateca_custom_endpoint"
170+
var PrivatecaEndpointEntry = &schema.Schema{
171+
Type: schema.TypeString,
172+
Optional: true,
173+
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
174+
"GOOGLE_PRIVATECA_CUSTOM_ENDPOINT",
175+
}, ""),
176+
}
177+
115178
var RecaptchaEnterpriseEndpointEntryKey = "recaptcha_enterprise_custom_endpoint"
116179
var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
117180
Type: schema.TypeString,
@@ -121,46 +184,62 @@ var RecaptchaEnterpriseEndpointEntry = &schema.Schema{
121184
}, ""),
122185
}
123186

124-
type DCLConfig struct {
125-
ApikeysBasePath string
126-
AssuredWorkloadsBasePath string
127-
CloudBuildWorkerPoolBasePath string
128-
ClouddeployBasePath string
129-
CloudResourceManagerBasePath string
130-
DataplexBasePath string
131-
EventarcBasePath string
132-
FirebaserulesBasePath string
133-
NetworkConnectivityBasePath string
134-
OrgPolicyBasePath string
135-
RecaptchaEnterpriseBasePath string
136-
}
137-
138-
func configureDCLProvider(provider *schema.Provider) {
139-
provider.Schema[ApikeysEndpointEntryKey] = ApikeysEndpointEntry
140-
provider.Schema[AssuredWorkloadsEndpointEntryKey] = AssuredWorkloadsEndpointEntry
141-
provider.Schema[CloudBuildWorkerPoolEndpointEntryKey] = CloudBuildWorkerPoolEndpointEntry
142-
provider.Schema[ClouddeployEndpointEntryKey] = ClouddeployEndpointEntry
143-
provider.Schema[CloudResourceManagerEndpointEntryKey] = CloudResourceManagerEndpointEntry
144-
provider.Schema[DataplexEndpointEntryKey] = DataplexEndpointEntry
145-
provider.Schema[EventarcEndpointEntryKey] = EventarcEndpointEntry
146-
provider.Schema[FirebaserulesEndpointEntryKey] = FirebaserulesEndpointEntry
147-
provider.Schema[NetworkConnectivityEndpointEntryKey] = NetworkConnectivityEndpointEntry
148-
provider.Schema[OrgPolicyEndpointEntryKey] = OrgPolicyEndpointEntry
149-
provider.Schema[RecaptchaEnterpriseEndpointEntryKey] = RecaptchaEnterpriseEndpointEntry
150-
}
151-
152-
func providerDCLConfigure(d *schema.ResourceData, config *Config) interface{} {
153-
config.ApikeysBasePath = d.Get(ApikeysEndpointEntryKey).(string)
154-
config.AssuredWorkloadsBasePath = d.Get(AssuredWorkloadsEndpointEntryKey).(string)
155-
config.CloudBuildWorkerPoolBasePath = d.Get(CloudBuildWorkerPoolEndpointEntryKey).(string)
156-
config.ClouddeployBasePath = d.Get(ClouddeployEndpointEntryKey).(string)
157-
config.CloudResourceManagerBasePath = d.Get(CloudResourceManagerEndpointEntryKey).(string)
158-
config.DataplexBasePath = d.Get(DataplexEndpointEntryKey).(string)
159-
config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
160-
config.FirebaserulesBasePath = d.Get(FirebaserulesEndpointEntryKey).(string)
161-
config.NetworkConnectivityBasePath = d.Get(NetworkConnectivityEndpointEntryKey).(string)
162-
config.OrgPolicyBasePath = d.Get(OrgPolicyEndpointEntryKey).(string)
163-
config.RecaptchaEnterpriseBasePath = d.Get(RecaptchaEnterpriseEndpointEntryKey).(string)
164-
config.CloudBuildWorkerPoolBasePath = d.Get(CloudBuildWorkerPoolEndpointEntryKey).(string)
165-
return config
166-
}
187+
//Add new values to config.go.erb config object declaration
188+
//ApikeysBasePath string
189+
//AssuredWorkloadsBasePath string
190+
//CloudBuildWorkerPoolBasePath string
191+
//ClouddeployBasePath string
192+
//CloudResourceManagerBasePath string
193+
//ComputeBasePath string
194+
//ContainerAwsBasePath string
195+
//ContainerAzureBasePath string
196+
//DataplexBasePath string
197+
//EventarcBasePath string
198+
//FirebaserulesBasePath string
199+
//LoggingBasePath string
200+
//MonitoringBasePath string
201+
//NetworkConnectivityBasePath string
202+
//OrgPolicyBasePath string
203+
//OSConfigBasePath string
204+
//PrivatecaBasePath string
205+
//RecaptchaEnterpriseBasePath string
206+
207+
//Add new values to provider.go.erb schema initialization
208+
// ApikeysEndpointEntryKey: ApikeysEndpointEntry,
209+
// AssuredWorkloadsEndpointEntryKey: AssuredWorkloadsEndpointEntry,
210+
// CloudBuildWorkerPoolEndpointEntryKey: CloudBuildWorkerPoolEndpointEntry,
211+
// ClouddeployEndpointEntryKey: ClouddeployEndpointEntry,
212+
// CloudResourceManagerEndpointEntryKey: CloudResourceManagerEndpointEntry,
213+
// ComputeEndpointEntryKey: ComputeEndpointEntry,
214+
// ContainerAwsEndpointEntryKey: ContainerAwsEndpointEntry,
215+
// ContainerAzureEndpointEntryKey: ContainerAzureEndpointEntry,
216+
// DataplexEndpointEntryKey: DataplexEndpointEntry,
217+
// EventarcEndpointEntryKey: EventarcEndpointEntry,
218+
// FirebaserulesEndpointEntryKey: FirebaserulesEndpointEntry,
219+
// LoggingEndpointEntryKey: LoggingEndpointEntry,
220+
// MonitoringEndpointEntryKey: MonitoringEndpointEntry,
221+
// NetworkConnectivityEndpointEntryKey: NetworkConnectivityEndpointEntry,
222+
// OrgPolicyEndpointEntryKey: OrgPolicyEndpointEntry,
223+
// OSConfigEndpointEntryKey: OSConfigEndpointEntry,
224+
// PrivatecaEndpointEntryKey: PrivatecaEndpointEntry,
225+
// RecaptchaEnterpriseEndpointEntryKey: RecaptchaEnterpriseEndpointEntry,
226+
227+
//Add new values to provider.go.erb - provider block read
228+
// config.ApikeysBasePath = d.Get(ApikeysEndpointEntryKey).(string)
229+
// config.AssuredWorkloadsBasePath = d.Get(AssuredWorkloadsEndpointEntryKey).(string)
230+
// config.CloudBuildWorkerPoolBasePath = d.Get(CloudBuildWorkerPoolEndpointEntryKey).(string)
231+
// config.ClouddeployBasePath = d.Get(ClouddeployEndpointEntryKey).(string)
232+
// config.CloudResourceManagerBasePath = d.Get(CloudResourceManagerEndpointEntryKey).(string)
233+
// config.ComputeBasePath = d.Get(ComputeEndpointEntryKey).(string)
234+
// config.ContainerAwsBasePath = d.Get(ContainerAwsEndpointEntryKey).(string)
235+
// config.ContainerAzureBasePath = d.Get(ContainerAzureEndpointEntryKey).(string)
236+
// config.DataplexBasePath = d.Get(DataplexEndpointEntryKey).(string)
237+
// config.EventarcBasePath = d.Get(EventarcEndpointEntryKey).(string)
238+
// config.FirebaserulesBasePath = d.Get(FirebaserulesEndpointEntryKey).(string)
239+
// config.LoggingBasePath = d.Get(LoggingEndpointEntryKey).(string)
240+
// config.MonitoringBasePath = d.Get(MonitoringEndpointEntryKey).(string)
241+
// config.NetworkConnectivityBasePath = d.Get(NetworkConnectivityEndpointEntryKey).(string)
242+
// config.OrgPolicyBasePath = d.Get(OrgPolicyEndpointEntryKey).(string)
243+
// config.OSConfigBasePath = d.Get(OSConfigEndpointEntryKey).(string)
244+
// config.PrivatecaBasePath = d.Get(PrivatecaEndpointEntryKey).(string)
245+
// config.RecaptchaEnterpriseBasePath = d.Get(RecaptchaEnterpriseEndpointEntryKey).(string)

0 commit comments

Comments
 (0)