googleAccessContextManagerServicePerimeters
Replace all existing Service Perimeters in an Access Policy with the Service Perimeters provided. This is done atomically. This is a bulk edit of all Service Perimeters and may override existing Service Perimeters created by googleAccessContextManagerServicePerimeter
, thus causing a permadiff if used alongside googleAccessContextManagerServicePerimeter
on the same parent.
To get more information about ServicePerimeters, see:
- API documentation
- How-to Guides
- Service Perimeter Quickstart
Example Usage - Access Context Manager Service Perimeters Basic
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleAccessContextManagerAccessPolicyAccessPolicy =
new google.accessContextManagerAccessPolicy.AccessContextManagerAccessPolicy(
this,
"access-policy",
{
parent: "organizations/123456789",
title: "my policy",
}
);
new google.accessContextManagerServicePerimeters.AccessContextManagerServicePerimeters(
this,
"service-perimeter",
{
parent: `accessPolicies/\${${googleAccessContextManagerAccessPolicyAccessPolicy.name}}`,
service_perimeters: [
{
name: `accessPolicies/\${${googleAccessContextManagerAccessPolicyAccessPolicy.name}}/servicePerimeters/`,
status: [
{
restricted_services: ["storage.googleapis.com"],
},
],
title: "",
},
{
name: `accessPolicies/\${${googleAccessContextManagerAccessPolicyAccessPolicy.name}}/servicePerimeters/`,
status: [
{
restricted_services: ["bigtable.googleapis.com"],
},
],
title: "",
},
],
}
);
new google.accessContextManagerAccessLevel.AccessContextManagerAccessLevel(
this,
"access-level",
{
basic: [
{
conditions: [
{
device_policy: [
{
os_constraints: [
{
os_type: "DESKTOP_CHROME_OS",
},
],
require_screen_lock: false,
},
],
regions: ["CH", "IT", "US"],
},
],
},
],
name: `accessPolicies/\${${googleAccessContextManagerAccessPolicyAccessPolicy.name}}/accessLevels/chromeos_no_lock`,
parent: `accessPolicies/\${${googleAccessContextManagerAccessPolicyAccessPolicy.name}}`,
title: "chromeos_no_lock",
}
);
Argument Reference
The following arguments are supported:
parent
- (Required) The AccessPolicy this ServicePerimeter lives in. Format: accessPolicies/{policy_id}
servicePerimeters
- (Optional) The desired Service Perimeters that should replace all existing Service Perimeters in the Access Policy. Structure is documented below.
The servicePerimeters
block supports:
-
name
- (Required) Resource name for the ServicePerimeter. The short_name component must begin with a letter and only include alphanumeric and '_'. Format: accessPolicies/{policy_id}/servicePerimeters/{short_name} -
title
- (Required) Human readable title. Must be unique within the Policy. -
description
- (Optional) Description of the ServicePerimeter and its use. Does not affect behavior. -
createTime
- (Output) Time the AccessPolicy was created in UTC. -
updateTime
- (Output) Time the AccessPolicy was updated in UTC. -
perimeterType
- (Optional) Specifies the type of the Perimeter. There are two types: regular and bridge. Regular Service Perimeter contains resources, access levels, and restricted services. Every resource can be in at most ONE regular Service Perimeter. In addition to being in a regular service perimeter, a resource can also be in zero or more perimeter bridges. A perimeter bridge only contains resources. Cross project operations are permitted if all effected resources share some perimeter (whether bridge or regular). Perimeter Bridge does not contain access levels or services: those are governed entirely by the regular perimeter that resource is in. Perimeter Bridges are typically useful when building more complex topologies with many independent perimeters that need to share some data with a common perimeter, but should not be able to share data among themselves. Default value isperimeterTypeRegular
. Possible values areperimeterTypeRegular
andperimeterTypeBridge
. -
status
- (Optional) ServicePerimeter configuration. Specifies sets of resources, restricted services and access levels that determine perimeter content and boundaries. Structure is documented below. -
spec
- (Optional) Proposed (or dry run) ServicePerimeter configuration. This configuration allows to specify and test ServicePerimeter configuration without enforcing actual access restrictions. Only allowed to be set when theuseExplicitDryRunSpec
flag is set. Structure is documented below. -
useExplicitDryRunSpec
- (Optional) Use explicit dry run spec flag. Ordinarily, a dry-run spec implicitly exists for all Service Perimeters, and that spec is identical to the status for those Service Perimeters. When this flag is set, it inhibits the generation of the implicit spec, thereby allowing the user to explicitly provide a configuration ("spec") to use in a dry-run version of the Service Perimeter. This allows the user to test changes to the enforced config ("status") without actually enforcing them. This testing is done through analyzing the differences between currently enforced and suggested restrictions. useExplicitDryRunSpec must bet set to True if any of the fields in the spec are set to non-default values.
-
resources
- (Optional) A list of GCP resources that are inside of the service perimeter. Currently only projects are allowed. Format: projects/{project_number} -
accessLevels
- (Optional) A list of AccessLevel resource names that allow resources within the ServicePerimeter to be accessed from the internet. AccessLevels listed must be in the same policy as this ServicePerimeter. Referencing a nonexistent AccessLevel is a syntax error. If no AccessLevel names are listed, resources within the perimeter can only be accessed via GCP calls with request origins within the perimeter. For Service Perimeter Bridge, must be empty. Format: accessPolicies/{policy_id}/accessLevels/{access_level_name} -
restrictedServices
- (Optional) GCP services that are subject to the Service Perimeter restrictions. Must contain a list of services. For example, ifstorageGoogleapisCom
is specified, access to the storage buckets inside the perimeter must meet the perimeter's access restrictions. -
vpcAccessibleServices
- (Optional) Specifies how APIs are allowed to communicate within the Service Perimeter. Structure is documented below. -
ingressPolicies
- (Optional) List ofingressPolicies
to apply to the perimeter. A perimeter may have multipleingressPolicies
, each of which is evaluated separately. Access is granted if anyingressPolicy
grants it. Must be empty for a perimeter bridge. Structure is documented below. -
egressPolicies
- (Optional) List of EgressPolicies to apply to the perimeter. A perimeter may have multiple EgressPolicies, each of which is evaluated separately. Access is granted if any EgressPolicy grants it. Must be empty for a perimeter bridge. Structure is documented below.
The vpcAccessibleServices
block supports:
-
enableRestriction
- (Optional) Whether to restrict API calls within the Service Perimeter to the list of APIs specified in 'allowedServices'. -
allowedServices
- (Optional) The list of APIs usable within the Service Perimeter. Must be empty unlessenableRestriction
is True.
The ingressPolicies
block supports:
-
ingressFrom
- (Optional) Defines the conditions on the source of a request causing thisingressPolicy
to apply. Structure is documented below. -
ingressTo
- (Optional) Defines the conditions on theapiOperation
and request destination that cause thisingressPolicy
to apply. Structure is documented below.
The ingressFrom
block supports:
-
identityType
- (Optional) Specifies the type of identities that are allowed access from outside the perimeter. If left unspecified, then members ofidentities
field will be allowed access. Possible values areidentityTypeUnspecified
,anyIdentity
,anyUserAccount
, andanyServiceAccount
. -
identities
- (Optional) A list of identities that are allowed access through this ingress policy. Should be in the format of email address. The email address should represent individual user or service account only. -
sources
- (Optional) Sources that thisingressPolicy
authorizes access from. Structure is documented below.
-
accessLevel
- (Optional) AnaccessLevel
resource name that allow resources within theservicePerimeters
to be accessed from the internet.accessLevels
listed must be in the same policy as thisservicePerimeter
. Referencing a nonexistentaccessLevel
will cause an error. If noaccessLevel
names are listed, resources within the perimeter can only be accessed via Google Cloud calls with request origins within the perimeter. ExampleaccessPolicies/myPolicy/accessLevels/myLevel
If * is specified, then all IngressSources will be allowed. -
resource
- (Optional) A Google Cloud resource that is allowed to ingress the perimeter. Requests from these resources will be allowed to access perimeter data. Currently only projects are allowed. Formatprojects/{projectNumber}
The project may be in any Google Cloud organization, not just the organization that the perimeter is defined in.*
is not allowed, the case of allowing all Google Cloud resources only is not supported.
-
resources
- (Optional) A list of resources, currently only projects in the formprojects/<projectnumber>
, protected by thisservicePerimeter
that are allowed to be accessed by sources defined in the correspondingingressFrom
. A request matches if it contains a resource in this list. If*
is specified for resources, then thisingressTo
rule will authorize access to all resources inside the perimeter, provided that the request also matches theoperations
field. -
operations
- (Optional) A list ofapiOperations
the sources specified in correspondingingressFrom
are allowed to perform in thisservicePerimeter
. Structure is documented below.
The operations
block supports:
-
serviceName
- (Optional) The name of the API whose methods or permissions theingressPolicy
oregressPolicy
want to allow. A singleapiOperation
withserviceName
field set to*
will allow all methods AND permissions for all services. -
methodSelectors
- (Optional) API methods or permissions to allow. Method or permission must belong to the service specified by serviceName field. A singlemethodSelector
entry with*
specified for the method field will allow all methods AND permissions for the service specified inserviceName
. Structure is documented below.
The methodSelectors
block supports:
-
method
- (Optional) Value for method should be a valid method name for the corresponding serviceName inapiOperation
. If*
used as value formethod
, then ALL methods and permissions are allowed. -
permission
- (Optional) Value for permission should be a valid Cloud IAM permission for the correspondingserviceName
inapiOperation
.
The egressPolicies
block supports:
-
egressFrom
- (Optional) Defines conditions on the source of a request causing thisegressPolicy
to apply. Structure is documented below. -
egressTo
- (Optional) Defines the conditions on theapiOperation
and destination resources that cause thisegressPolicy
to apply. Structure is documented below.
The egressFrom
block supports:
-
identityType
- (Optional) Specifies the type of identities that are allowed access to outside the perimeter. If left unspecified, then members ofidentities
field will be allowed access. Possible values areidentityTypeUnspecified
,anyIdentity
,anyUserAccount
, andanyServiceAccount
. -
identities
- (Optional) A list of identities that are allowed access through thisegressPolicy
. Should be in the format of email address. The email address should represent individual user or service account only.
-
resources
- (Optional) A list of resources, currently only projects in the formprojects/<projectnumber>
, that match this to stanza. A request matches if it contains a resource in this list. If * is specified for resources, then thisegressTo
rule will authorize access to all resources outside the perimeter. -
externalResources
- (Optional) A list of external resources that are allowed to be accessed. A request matches if it contains an external resource in this list (Example: s3://bucket/path). Currently '*' is not allowed. -
operations
- (Optional) A list ofapiOperations
that this egress rule applies to. A request matches if it contains an operation/service in this list. Structure is documented below.
The operations
block supports:
-
serviceName
- (Optional) The name of the API whose methods or permissions theingressPolicy
oregressPolicy
want to allow. A singleapiOperation
with serviceName field set to*
will allow all methods AND permissions for all services. -
methodSelectors
- (Optional) API methods or permissions to allow. Method or permission must belong to the service specified byserviceName
field. A single MethodSelector entry with*
specified for themethod
field will allow all methods AND permissions for the service specified inserviceName
. Structure is documented below.
The methodSelectors
block supports:
-
method
- (Optional) Value formethod
should be a valid method name for the correspondingserviceName
inapiOperation
. If*
used as value for method, then ALL methods and permissions are allowed. -
permission
- (Optional) Value for permission should be a valid Cloud IAM permission for the correspondingserviceName
inapiOperation
.
-
resources
- (Optional) A list of GCP resources that are inside of the service perimeter. Currently only projects are allowed. Format: projects/{project_number} -
accessLevels
- (Optional) A list of AccessLevel resource names that allow resources within the ServicePerimeter to be accessed from the internet. AccessLevels listed must be in the same policy as this ServicePerimeter. Referencing a nonexistent AccessLevel is a syntax error. If no AccessLevel names are listed, resources within the perimeter can only be accessed via GCP calls with request origins within the perimeter. For Service Perimeter Bridge, must be empty. Format: accessPolicies/{policy_id}/accessLevels/{access_level_name} -
restrictedServices
- (Optional) GCP services that are subject to the Service Perimeter restrictions. Must contain a list of services. For example, ifstorageGoogleapisCom
is specified, access to the storage buckets inside the perimeter must meet the perimeter's access restrictions. -
vpcAccessibleServices
- (Optional) Specifies how APIs are allowed to communicate within the Service Perimeter. Structure is documented below. -
ingressPolicies
- (Optional) List ofingressPolicies
to apply to the perimeter. A perimeter may have multipleingressPolicies
, each of which is evaluated separately. Access is granted if anyingressPolicy
grants it. Must be empty for a perimeter bridge. Structure is documented below. -
egressPolicies
- (Optional) List of EgressPolicies to apply to the perimeter. A perimeter may have multiple EgressPolicies, each of which is evaluated separately. Access is granted if any EgressPolicy grants it. Must be empty for a perimeter bridge. Structure is documented below.
The vpcAccessibleServices
block supports:
-
enableRestriction
- (Optional) Whether to restrict API calls within the Service Perimeter to the list of APIs specified in 'allowedServices'. -
allowedServices
- (Optional) The list of APIs usable within the Service Perimeter. Must be empty unlessenableRestriction
is True.
The ingressPolicies
block supports:
-
ingressFrom
- (Optional) Defines the conditions on the source of a request causing thisingressPolicy
to apply. Structure is documented below. -
ingressTo
- (Optional) Defines the conditions on theapiOperation
and request destination that cause thisingressPolicy
to apply. Structure is documented below.
The ingressFrom
block supports:
-
identityType
- (Optional) Specifies the type of identities that are allowed access from outside the perimeter. If left unspecified, then members ofidentities
field will be allowed access. Possible values areidentityTypeUnspecified
,anyIdentity
,anyUserAccount
, andanyServiceAccount
. -
identities
- (Optional) A list of identities that are allowed access through this ingress policy. Should be in the format of email address. The email address should represent individual user or service account only. -
sources
- (Optional) Sources that thisingressPolicy
authorizes access from. Structure is documented below.
-
accessLevel
- (Optional) AnaccessLevel
resource name that allow resources within theservicePerimeters
to be accessed from the internet.accessLevels
listed must be in the same policy as thisservicePerimeter
. Referencing a nonexistentaccessLevel
will cause an error. If noaccessLevel
names are listed, resources within the perimeter can only be accessed via Google Cloud calls with request origins within the perimeter. ExampleaccessPolicies/myPolicy/accessLevels/myLevel
If * is specified, then all IngressSources will be allowed. -
resource
- (Optional) A Google Cloud resource that is allowed to ingress the perimeter. Requests from these resources will be allowed to access perimeter data. Currently only projects are allowed. Formatprojects/{projectNumber}
The project may be in any Google Cloud organization, not just the organization that the perimeter is defined in.*
is not allowed, the case of allowing all Google Cloud resources only is not supported.
-
resources
- (Optional) A list of resources, currently only projects in the formprojects/<projectnumber>
, protected by thisservicePerimeter
that are allowed to be accessed by sources defined in the correspondingingressFrom
. A request matches if it contains a resource in this list. If*
is specified for resources, then thisingressTo
rule will authorize access to all resources inside the perimeter, provided that the request also matches theoperations
field. -
operations
- (Optional) A list ofapiOperations
the sources specified in correspondingingressFrom
are allowed to perform in thisservicePerimeter
. Structure is documented below.
The operations
block supports:
-
serviceName
- (Optional) The name of the API whose methods or permissions theingressPolicy
oregressPolicy
want to allow. A singleapiOperation
withserviceName
field set to*
will allow all methods AND permissions for all services. -
methodSelectors
- (Optional) API methods or permissions to allow. Method or permission must belong to the service specified by serviceName field. A singlemethodSelector
entry with*
specified for the method field will allow all methods AND permissions for the service specified inserviceName
. Structure is documented below.
The methodSelectors
block supports:
-
method
- (Optional) Value for method should be a valid method name for the corresponding serviceName inapiOperation
. If*
used as value formethod
, then ALL methods and permissions are allowed. -
permission
- (Optional) Value for permission should be a valid Cloud IAM permission for the correspondingserviceName
inapiOperation
.
The egressPolicies
block supports:
-
egressFrom
- (Optional) Defines conditions on the source of a request causing thisegressPolicy
to apply. Structure is documented below. -
egressTo
- (Optional) Defines the conditions on theapiOperation
and destination resources that cause thisegressPolicy
to apply. Structure is documented below.
The egressFrom
block supports:
-
identityType
- (Optional) Specifies the type of identities that are allowed access to outside the perimeter. If left unspecified, then members ofidentities
field will be allowed access. Possible values areidentityTypeUnspecified
,anyIdentity
,anyUserAccount
, andanyServiceAccount
. -
identities
- (Optional) A list of identities that are allowed access through thisegressPolicy
. Should be in the format of email address. The email address should represent individual user or service account only.
-
resources
- (Optional) A list of resources, currently only projects in the formprojects/<projectnumber>
, that match this to stanza. A request matches if it contains a resource in this list. If * is specified for resources, then thisegressTo
rule will authorize access to all resources outside the perimeter. -
externalResources
- (Optional) A list of external resources that are allowed to be accessed. A request matches if it contains an external resource in this list (Example: s3://bucket/path). Currently '*' is not allowed. -
operations
- (Optional) A list ofapiOperations
that this egress rule applies to. A request matches if it contains an operation/service in this list. Structure is documented below.
The operations
block supports:
-
serviceName
- (Optional) The name of the API whose methods or permissions theingressPolicy
oregressPolicy
want to allow. A singleapiOperation
with serviceName field set to*
will allow all methods AND permissions for all services. -
methodSelectors
- (Optional) API methods or permissions to allow. Method or permission must belong to the service specified byserviceName
field. A single MethodSelector entry with*
specified for themethod
field will allow all methods AND permissions for the service specified inserviceName
. Structure is documented below.
The methodSelectors
block supports:
-
method
- (Optional) Value formethod
should be a valid method name for the correspondingserviceName
inapiOperation
. If*
used as value for method, then ALL methods and permissions are allowed. -
permission
- (Optional) Value for permission should be a valid Cloud IAM permission for the correspondingserviceName
inapiOperation
.
Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format{{parent}}/servicePerimeters
Timeouts
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.
Import
ServicePerimeters can be imported using any of these accepted formats: