hcp projects iam set-policy
Command: hcp projects iam set-policy
The hcp projects iam set-policy
command sets the IAM policy for the project,
given a project ID and a file encoded in JSON that contains the IAM policy. If
adding or removing a single principal from the policy, prefer using hcp
projects iam add-binding
and the related hcp projects iam delete-binding
.
The policy file is expected to be a file encoded in JSON that contains the IAM policy.
The format for the policy JSON file is an object with the following format:
If set, the etag of the policy must be equal to that of the existing policy. To
view the existing policy and its etag, run hcp projects iam read-policy
--format=json
. If unset, the existing policy's etag will be fetched and used.
Usage
Examples
Set the IAM Policy for a project:
Required flags
--policy-file=PATH
- The path to a file containing an IAM policy object.