blob: b88ce5c1ff8e0a7d3faf40f3e5607f581a8fcb8f [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Access Context Manager (VPC Service Controls)"
description: |-
Replace all existing Access Levels in an Access Policy with the Access Levels provided.
---
# google\_access\_context\_manager\_access\_levels
Replace all existing Access Levels in an Access Policy with the Access Levels provided. This is done atomically.
This is a bulk edit of all Access Levels and may override existing Access Levels created by `google_access_context_manager_access_level`,
thus causing a permadiff if used alongside `google_access_context_manager_access_level` on the same parent.
To get more information about AccessLevels, see:
* [API documentation](https://cloud.google.com/access-context-manager/docs/reference/rest/v1/accessPolicies.accessLevels)
* How-to Guides
* [Access Policy Quickstart](https://cloud.google.com/access-context-manager/docs/quickstart)
## Example Usage - Access Context Manager Access Levels Basic
```hcl
resource "google_access_context_manager_access_levels" "access-levels" {
parent = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}"
access_levels {
name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/chromeos_no_lock"
title = "chromeos_no_lock"
basic {
conditions {
device_policy {
require_screen_lock = true
os_constraints {
os_type = "DESKTOP_CHROME_OS"
}
}
regions = [
"CH",
"IT",
"US",
]
}
}
}
access_levels {
name = "accessPolicies/${google_access_context_manager_access_policy.access-policy.name}/accessLevels/mac_no_lock"
title = "mac_no_lock"
basic {
conditions {
device_policy {
require_screen_lock = true
os_constraints {
os_type = "DESKTOP_MAC"
}
}
regions = [
"CH",
"IT",
"US",
]
}
}
}
}
resource "google_access_context_manager_access_policy" "access-policy" {
parent = "organizations/123456789"
title = "my policy"
}
```
## Argument Reference
The following arguments are supported:
* `parent` -
(Required)
The AccessPolicy this AccessLevel lives in.
Format: accessPolicies/{policy_id}
- - -
* `access_levels` -
(Optional)
The desired Access Levels that should replace all existing Access Levels in the Access Policy.
Structure is [documented below](#nested_access_levels).
<a name="nested_access_levels"></a>The `access_levels` block supports:
* `name` -
(Required)
Resource name for the Access Level. The short_name component must begin
with a letter and only include alphanumeric and '_'.
Format: accessPolicies/{policy_id}/accessLevels/{short_name}
* `title` -
(Required)
Human readable title. Must be unique within the Policy.
* `description` -
(Optional)
Description of the AccessLevel and its use. Does not affect behavior.
* `basic` -
(Optional)
A set of predefined conditions for the access level and a combining function.
Structure is [documented below](#nested_basic).
* `custom` -
(Optional)
Custom access level conditions are set using the Cloud Common Expression Language to represent the necessary conditions for the level to apply to a request.
See CEL spec at: https://github.com/google/cel-spec.
Structure is [documented below](#nested_custom).
<a name="nested_basic"></a>The `basic` block supports:
* `combining_function` -
(Optional)
How the conditions list should be combined to determine if a request
is granted this AccessLevel. If AND is used, each Condition in
conditions must be satisfied for the AccessLevel to be applied. If
OR is used, at least one Condition in conditions must be satisfied
for the AccessLevel to be applied.
Default value is `AND`.
Possible values are: `AND`, `OR`.
* `conditions` -
(Required)
A set of requirements for the AccessLevel to be granted.
Structure is [documented below](#nested_conditions).
<a name="nested_conditions"></a>The `conditions` block supports:
* `ip_subnetworks` -
(Optional)
A list of CIDR block IP subnetwork specification. May be IPv4
or IPv6.
Note that for a CIDR IP address block, the specified IP address
portion must be properly truncated (i.e. all the host bits must
be zero) or the input is considered malformed. For example,
"192.0.2.0/24" is accepted but "192.0.2.1/24" is not. Similarly,
for IPv6, "2001:db8::/32" is accepted whereas "2001:db8::1/32"
is not. The originating IP of a request must be in one of the
listed subnets in order for this Condition to be true.
If empty, all IP addresses are allowed.
* `required_access_levels` -
(Optional)
A list of other access levels defined in the same Policy,
referenced by resource name. Referencing an AccessLevel which
does not exist is an error. All access levels listed must be
granted for the Condition to be true.
Format: accessPolicies/{policy_id}/accessLevels/{short_name}
* `members` -
(Optional)
An allowed list of members (users, service accounts).
Using groups is not supported yet.
The signed-in user originating the request must be a part of one
of the provided members. If not specified, a request may come
from any user (logged in/not logged in, not present in any
groups, etc.).
Formats: `user:{emailid}`, `serviceAccount:{emailid}`
* `negate` -
(Optional)
Whether to negate the Condition. If true, the Condition becomes
a NAND over its non-empty fields, each field must be false for
the Condition overall to be satisfied. Defaults to false.
* `device_policy` -
(Optional)
Device specific restrictions, all restrictions must hold for
the Condition to be true. If not specified, all devices are
allowed.
Structure is [documented below](#nested_device_policy).
* `regions` -
(Optional)
The request must originate from one of the provided
countries/regions.
Format: A valid ISO 3166-1 alpha-2 code.
* `vpc_network_sources` -
(Optional)
The request must originate from one of the provided VPC networks in Google Cloud. Cannot specify this field together with `ip_subnetworks`.
Structure is [documented below](#nested_vpc_network_sources).
<a name="nested_device_policy"></a>The `device_policy` block supports:
* `require_screen_lock` -
(Optional)
Whether or not screenlock is required for the DevicePolicy
to be true. Defaults to false.
* `allowed_encryption_statuses` -
(Optional)
A list of allowed encryptions statuses.
An empty list allows all statuses.
Each value may be one of: `ENCRYPTION_UNSPECIFIED`, `ENCRYPTION_UNSUPPORTED`, `UNENCRYPTED`, `ENCRYPTED`.
* `allowed_device_management_levels` -
(Optional)
A list of allowed device management levels.
An empty list allows all management levels.
Each value may be one of: `MANAGEMENT_UNSPECIFIED`, `NONE`, `BASIC`, `COMPLETE`.
* `os_constraints` -
(Optional)
A list of allowed OS versions.
An empty list allows all types and all versions.
Structure is [documented below](#nested_os_constraints).
* `require_admin_approval` -
(Optional)
Whether the device needs to be approved by the customer admin.
* `require_corp_owned` -
(Optional)
Whether the device needs to be corp owned.
<a name="nested_os_constraints"></a>The `os_constraints` block supports:
* `minimum_version` -
(Optional)
The minimum allowed OS version. If not set, any version
of this OS satisfies the constraint.
Format: "major.minor.patch" such as "10.5.301", "9.2.1".
* `os_type` -
(Required)
The operating system type of the device.
Possible values are: `OS_UNSPECIFIED`, `DESKTOP_MAC`, `DESKTOP_WINDOWS`, `DESKTOP_LINUX`, `DESKTOP_CHROME_OS`, `ANDROID`, `IOS`.
<a name="nested_vpc_network_sources"></a>The `vpc_network_sources` block supports:
* `vpc_subnetwork` -
(Optional)
Sub networks within a VPC network.
Structure is [documented below](#nested_vpc_subnetwork).
<a name="nested_vpc_subnetwork"></a>The `vpc_subnetwork` block supports:
* `network` -
(Required)
Required. Network name to be allowed by this Access Level. Networks of foreign organizations requires `compute.network.get` permission to be granted to caller.
* `vpc_ip_subnetworks` -
(Optional)
CIDR block IP subnetwork specification. Must be IPv4.
<a name="nested_custom"></a>The `custom` block supports:
* `expr` -
(Required)
Represents a textual expression in the Common Expression Language (CEL) syntax. CEL is a C-like expression language.
This page details the objects and attributes that are used to the build the CEL expressions for
custom access levels - https://cloud.google.com/access-context-manager/docs/custom-access-level-spec.
Structure is [documented below](#nested_expr).
<a name="nested_expr"></a>The `expr` block supports:
* `expression` -
(Required)
Textual representation of an expression in Common Expression Language syntax.
* `title` -
(Optional)
Title for the expression, i.e. a short string describing its purpose.
* `description` -
(Optional)
Description of the expression
* `location` -
(Optional)
String indicating the location of the expression for error reporting, e.g. a file name and a position in the file
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
* `id` - an identifier for the resource with format `{{parent}}/accessLevels`
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.
## Import
AccessLevels can be imported using any of these accepted formats:
* `{{parent}}/accessLevels`
* `{{parent}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import AccessLevels using one of the formats above. For example:
```tf
import {
id = "{{parent}}/accessLevels"
to = google_access_context_manager_access_levels.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), AccessLevels can be imported using one of the formats above. For example:
```
$ terraform import google_access_context_manager_access_levels.default {{parent}}/accessLevels
$ terraform import google_access_context_manager_access_levels.default {{parent}}
```