Skip to content

Commit

Permalink
Move Custom Org Policy from beta to GA (#9171) (#16220)
Browse files Browse the repository at this point in the history
[upstream:b75e3183c2a77da7b2bb177dd2404d748afe1bb4]

Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
modular-magician committed Oct 11, 2023
1 parent cdb1ba9 commit 423f8e8
Show file tree
Hide file tree
Showing 12 changed files with 886 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .changelog/9171.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
`google_org_policy_custom_constraint` (GA)
```
2 changes: 1 addition & 1 deletion google/fwmodels/provider_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ type ProviderModel struct {
NetworkSecurityCustomEndpoint types.String `tfsdk:"network_security_custom_endpoint"`
NetworkServicesCustomEndpoint types.String `tfsdk:"network_services_custom_endpoint"`
NotebooksCustomEndpoint types.String `tfsdk:"notebooks_custom_endpoint"`
OrgPolicyCustomEndpoint types.String `tfsdk:"org_policy_custom_endpoint"`
OSConfigCustomEndpoint types.String `tfsdk:"os_config_custom_endpoint"`
OSLoginCustomEndpoint types.String `tfsdk:"os_login_custom_endpoint"`
PrivatecaCustomEndpoint types.String `tfsdk:"privateca_custom_endpoint"`
Expand Down Expand Up @@ -147,7 +148,6 @@ type ProviderModel struct {
CloudResourceManagerCustomEndpoint types.String `tfsdk:"cloud_resource_manager_custom_endpoint"`
EventarcCustomEndpoint types.String `tfsdk:"eventarc_custom_endpoint"`
FirebaserulesCustomEndpoint types.String `tfsdk:"firebaserules_custom_endpoint"`
OrgPolicyCustomEndpoint types.String `tfsdk:"org_policy_custom_endpoint"`
RecaptchaEnterpriseCustomEndpoint types.String `tfsdk:"recaptcha_enterprise_custom_endpoint"`

GkehubFeatureCustomEndpoint types.String `tfsdk:"gkehub_feature_custom_endpoint"`
Expand Down
6 changes: 6 additions & 0 deletions google/fwprovider/framework_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,12 @@ func (p *FrameworkProvider) Schema(_ context.Context, _ provider.SchemaRequest,
transport_tpg.CustomEndpointValidator(),
},
},
"org_policy_custom_endpoint": &schema.StringAttribute{
Optional: true,
Validators: []validator.String{
transport_tpg.CustomEndpointValidator(),
},
},
"os_config_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 @@ -125,6 +125,7 @@ type FrameworkProviderConfig struct {
NetworkSecurityBasePath string
NetworkServicesBasePath string
NotebooksBasePath string
OrgPolicyBasePath string
OSConfigBasePath string
OSLoginBasePath string
PrivatecaBasePath string
Expand Down Expand Up @@ -262,6 +263,7 @@ func (p *FrameworkProviderConfig) LoadAndValidateFramework(ctx context.Context,
p.NetworkSecurityBasePath = data.NetworkSecurityCustomEndpoint.ValueString()
p.NetworkServicesBasePath = data.NetworkServicesCustomEndpoint.ValueString()
p.NotebooksBasePath = data.NotebooksCustomEndpoint.ValueString()
p.OrgPolicyBasePath = data.OrgPolicyCustomEndpoint.ValueString()
p.OSConfigBasePath = data.OSConfigCustomEndpoint.ValueString()
p.OSLoginBasePath = data.OSLoginCustomEndpoint.ValueString()
p.PrivatecaBasePath = data.PrivatecaCustomEndpoint.ValueString()
Expand Down Expand Up @@ -1010,6 +1012,14 @@ func (p *FrameworkProviderConfig) HandleDefaults(ctx context.Context, data *fwmo
data.NotebooksCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.OrgPolicyCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_ORG_POLICY_CUSTOM_ENDPOINT",
}, transport_tpg.DefaultBasePaths[transport_tpg.OrgPolicyBasePathKey])
if customEndpoint != nil {
data.OrgPolicyCustomEndpoint = types.StringValue(customEndpoint.(string))
}
}
if data.OSConfigCustomEndpoint.IsNull() {
customEndpoint := transport_tpg.MultiEnvDefault([]string{
"GOOGLE_OS_CONFIG_CUSTOM_ENDPOINT",
Expand Down
12 changes: 10 additions & 2 deletions google/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ import (
"github.com/hashicorp/terraform-provider-google/google/services/networksecurity"
"github.com/hashicorp/terraform-provider-google/google/services/networkservices"
"github.com/hashicorp/terraform-provider-google/google/services/notebooks"
"github.com/hashicorp/terraform-provider-google/google/services/orgpolicy"
"github.com/hashicorp/terraform-provider-google/google/services/osconfig"
"github.com/hashicorp/terraform-provider-google/google/services/oslogin"
"github.com/hashicorp/terraform-provider-google/google/services/privateca"
Expand Down Expand Up @@ -609,6 +610,11 @@ func Provider() *schema.Provider {
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"org_policy_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: transport_tpg.ValidateCustomEndpoint,
},
"os_config_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -997,9 +1003,9 @@ func DatasourceMapWithErrors() (map[string]*schema.Resource, error) {
})
}

// Generated resources: 331
// Generated resources: 332
// Generated IAM resources: 207
// Total generated resources: 538
// Total generated resources: 539
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand Down Expand Up @@ -1450,6 +1456,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_notebooks_runtime_iam_binding": tpgiamresource.ResourceIamBinding(notebooks.NotebooksRuntimeIamSchema, notebooks.NotebooksRuntimeIamUpdaterProducer, notebooks.NotebooksRuntimeIdParseFunc),
"google_notebooks_runtime_iam_member": tpgiamresource.ResourceIamMember(notebooks.NotebooksRuntimeIamSchema, notebooks.NotebooksRuntimeIamUpdaterProducer, notebooks.NotebooksRuntimeIdParseFunc),
"google_notebooks_runtime_iam_policy": tpgiamresource.ResourceIamPolicy(notebooks.NotebooksRuntimeIamSchema, notebooks.NotebooksRuntimeIamUpdaterProducer, notebooks.NotebooksRuntimeIdParseFunc),
"google_org_policy_custom_constraint": orgpolicy.ResourceOrgPolicyCustomConstraint(),
"google_os_config_patch_deployment": osconfig.ResourceOSConfigPatchDeployment(),
"google_os_login_ssh_public_key": oslogin.ResourceOSLoginSSHPublicKey(),
"google_privateca_ca_pool": privateca.ResourcePrivatecaCaPool(),
Expand Down Expand Up @@ -1851,6 +1858,7 @@ func ProviderConfigure(ctx context.Context, d *schema.ResourceData, p *schema.Pr
config.NetworkSecurityBasePath = d.Get("network_security_custom_endpoint").(string)
config.NetworkServicesBasePath = d.Get("network_services_custom_endpoint").(string)
config.NotebooksBasePath = d.Get("notebooks_custom_endpoint").(string)
config.OrgPolicyBasePath = d.Get("org_policy_custom_endpoint").(string)
config.OSConfigBasePath = d.Get("os_config_custom_endpoint").(string)
config.OSLoginBasePath = d.Get("os_login_custom_endpoint").(string)
config.PrivatecaBasePath = d.Get("privateca_custom_endpoint").(string)
Expand Down
Loading

0 comments on commit 423f8e8

Please sign in to comment.