Skip to content

Commit c88fa7b

Browse files
Lakshman single datasource generation (#14598) (#23919)
[upstream:88a3b9b9f43c264719d2069e26b622d8e64149bc] Signed-off-by: Modular Magician <[email protected]>
1 parent 7ef64cb commit c88fa7b

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

google/provider/provider_mmv1_resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ var handwrittenDatasources = map[string]*schema.Resource{
305305
"google_iam_testable_permissions": resourcemanager.DataSourceGoogleIamTestablePermissions(),
306306
"google_iam_workload_identity_pool": iambeta.DataSourceIAMBetaWorkloadIdentityPool(),
307307
"google_iam_workload_identity_pool_provider": iambeta.DataSourceIAMBetaWorkloadIdentityPoolProvider(),
308-
"google_iap_client": iap.DataSourceGoogleIapClient(),
308+
"google_iap_client": iap.DataSourceIapClient(),
309309
"google_kms_crypto_key": kms.DataSourceGoogleKmsCryptoKey(),
310310
"google_kms_crypto_keys": kms.DataSourceGoogleKmsCryptoKeys(),
311311
"google_kms_crypto_key_version": kms.DataSourceGoogleKmsCryptoKeyVersion(),
Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
// Copyright (c) HashiCorp, Inc.
22
// SPDX-License-Identifier: MPL-2.0
3+
34
// ----------------------------------------------------------------------------
45
//
5-
// *** AUTO GENERATED CODE *** Type: Handwritten ***
6+
// *** AUTO GENERATED CODE *** Type: MMv1 ***
67
//
78
// ----------------------------------------------------------------------------
89
//
910
// This code is generated by Magic Modules using the following:
1011
//
11-
// Source file: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/third_party/terraform/services/iap/data_source_iap_client.go
12+
// Configuration: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products/iap/Client.yaml
13+
// Template: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/terraform/datasource.go.tmpl
1214
//
1315
// DO NOT EDIT this file directly. Any changes made to this file will be
1416
// overwritten during the next generation cycle.
@@ -20,29 +22,37 @@ import (
2022
"fmt"
2123

2224
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
25+
2326
"github.com/hashicorp/terraform-provider-google/google/tpgresource"
2427
transport_tpg "github.com/hashicorp/terraform-provider-google/google/transport"
2528
)
2629

27-
func DataSourceGoogleIapClient() *schema.Resource {
30+
func DataSourceIapClient() *schema.Resource {
31+
rs := ResourceIapClient().Schema
2832

29-
dsSchema := tpgresource.DatasourceSchemaFromResourceSchema(ResourceIapClient().Schema)
33+
dsSchema := tpgresource.DatasourceSchemaFromResourceSchema(rs)
34+
35+
// Set 'Required' schema elements
3036
tpgresource.AddRequiredFieldsToSchema(dsSchema, "brand", "client_id")
3137

38+
// Set 'Optional' schema elements
39+
tpgresource.AddOptionalFieldsToSchema(dsSchema)
40+
3241
return &schema.Resource{
33-
Read: dataSourceGoogleIapClientRead,
42+
Read: dataSourceIapClientRead,
3443
Schema: dsSchema,
3544
}
3645
}
3746

38-
func dataSourceGoogleIapClientRead(d *schema.ResourceData, meta interface{}) error {
47+
func dataSourceIapClientRead(d *schema.ResourceData, meta interface{}) error {
3948
config := meta.(*transport_tpg.Config)
4049

4150
id, err := tpgresource.ReplaceVars(d, config, "{{brand}}/identityAwareProxyClients/{{client_id}}")
4251
if err != nil {
43-
return fmt.Errorf("Error constructing id: %s", err)
52+
return err
4453
}
4554
d.SetId(id)
55+
4656
err = resourceIapClientRead(d, meta)
4757
if err != nil {
4858
return err
@@ -51,5 +61,6 @@ func dataSourceGoogleIapClientRead(d *schema.ResourceData, meta interface{}) err
5161
if d.Id() == "" {
5262
return fmt.Errorf("%s not found", id)
5363
}
64+
5465
return nil
5566
}

0 commit comments

Comments
 (0)