Skip to content

Commit

Permalink
add access approval settings resources (#3828) (#7010)
Browse files Browse the repository at this point in the history
* add access approval for project, folder, org

* add access approval settings resources

* changes from review comments

* remove description line about repeated entries in list, since its a set and there won't be repeats

* add delete to access approval settings, make enrolled_services required, notification_emails default from api

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Aug 12, 2020
1 parent 4e9b7d8 commit 449d358
Show file tree
Hide file tree
Showing 13 changed files with 1,936 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .changelog/3828.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```release-note:new-resource
`google_folder_access_approval_settings`
```
```release-note:new-resource
`google_organization_access_approval_settings`
```
```release-note:new-resource
`google_project_access_approval_settings`
```
3 changes: 3 additions & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ type Config struct {

tokenSource oauth2.TokenSource

AccessApprovalBasePath string
AccessContextManagerBasePath string
ActiveDirectoryBasePath string
AppEngineBasePath string
Expand Down Expand Up @@ -225,6 +226,7 @@ type Config struct {
}

// Generated product base paths
var AccessApprovalDefaultBasePath = "https://accessapproval.googleapis.com/v1/"
var AccessContextManagerDefaultBasePath = "https://accesscontextmanager.googleapis.com/v1/"
var ActiveDirectoryDefaultBasePath = "https://managedidentities.googleapis.com/v1/"
var AppEngineDefaultBasePath = "https://appengine.googleapis.com/v1/"
Expand Down Expand Up @@ -771,6 +773,7 @@ func removeBasePathVersion(url string) string {
// values to a default. After using this, you should call config.LoadAndValidate.
func ConfigureBasePaths(c *Config) {
// Generated Products
c.AccessApprovalBasePath = AccessApprovalDefaultBasePath
c.AccessContextManagerBasePath = AccessContextManagerDefaultBasePath
c.ActiveDirectoryBasePath = ActiveDirectoryDefaultBasePath
c.AppEngineBasePath = AppEngineDefaultBasePath
Expand Down
16 changes: 14 additions & 2 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ func Provider() terraform.ResourceProvider {
},

// Generated Products
"access_approval_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateCustomEndpoint,
DefaultFunc: schema.MultiEnvDefaultFunc([]string{
"GOOGLE_ACCESS_APPROVAL_CUSTOM_ENDPOINT",
}, AccessApprovalDefaultBasePath),
},
"access_context_manager_custom_endpoint": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -607,9 +615,9 @@ func Provider() terraform.ResourceProvider {
return provider
}

// Generated resources: 149
// Generated resources: 152
// Generated IAM resources: 57
// Total generated resources: 206
// Total generated resources: 209
func ResourceMap() map[string]*schema.Resource {
resourceMap, _ := ResourceMapWithErrors()
return resourceMap
Expand All @@ -618,6 +626,9 @@ func ResourceMap() map[string]*schema.Resource {
func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
return mergeResourceMaps(
map[string]*schema.Resource{
"google_folder_access_approval_settings": resourceAccessApprovalFolderSettings(),
"google_project_access_approval_settings": resourceAccessApprovalProjectSettings(),
"google_organization_access_approval_settings": resourceAccessApprovalOrganizationSettings(),
"google_access_context_manager_access_policy": resourceAccessContextManagerAccessPolicy(),
"google_access_context_manager_access_level": resourceAccessContextManagerAccessLevel(),
"google_access_context_manager_service_perimeter": resourceAccessContextManagerServicePerimeter(),
Expand Down Expand Up @@ -993,6 +1004,7 @@ func providerConfigure(d *schema.ResourceData, p *schema.Provider, terraformVers
config.BatchingConfig = batchCfg

// Generated products
config.AccessApprovalBasePath = d.Get("access_approval_custom_endpoint").(string)
config.AccessContextManagerBasePath = d.Get("access_context_manager_custom_endpoint").(string)
config.ActiveDirectoryBasePath = d.Get("active_directory_custom_endpoint").(string)
config.AppEngineBasePath = d.Get("app_engine_custom_endpoint").(string)
Expand Down
Loading

0 comments on commit 449d358

Please sign in to comment.