|
| 1 | +--- |
| 2 | +Title: "Custom IAM Role Resource" |
| 3 | +Description: |- |
| 4 | + Creating a custom IAM role. |
| 5 | +--- |
| 6 | + |
| 7 | +# Custom IAM Role Resource |
| 8 | + |
| 9 | +This resource enables users to create custom IAM roles in TMC. |
| 10 | + |
| 11 | +For more information regarding custom roles, see [Custom Role][custom-role]. |
| 12 | + |
| 13 | +[custom-role]: https://docs.vmware.com/en/VMware-Tanzu-Mission-Control/services/tanzumc-using/GUID-F314ED9E-2736-48CC-A1BB-CB9C32900B30.html |
| 14 | + |
| 15 | +## Example Usage |
| 16 | + |
| 17 | +```terraform |
| 18 | +resource "tanzu-mission-control_custom_iam_role" "demo-role" { |
| 19 | + name = "tf-custom-role" |
| 20 | +
|
| 21 | + spec { |
| 22 | + is_deprecated = false |
| 23 | +
|
| 24 | + aggregation_rule { |
| 25 | + cluster_role_selector { |
| 26 | + match_labels = { |
| 27 | + key = "value" |
| 28 | + } |
| 29 | + } |
| 30 | +
|
| 31 | + cluster_role_selector { |
| 32 | + match_expression { |
| 33 | + key = "aa" |
| 34 | + operator = "Exists" |
| 35 | + values = ["aa", "bb", "cc"] |
| 36 | + } |
| 37 | + } |
| 38 | + } |
| 39 | +
|
| 40 | + allowed_scopes = [ |
| 41 | + "ORGANIZATION", |
| 42 | + "CLUSTER_GROUP", |
| 43 | + "CLUSTER" |
| 44 | + ] |
| 45 | +
|
| 46 | + tanzu_permissions = [] |
| 47 | +
|
| 48 | + kubernetes_permissions { |
| 49 | + rule { |
| 50 | + resources = ["deployments"] |
| 51 | + verbs = ["get", "list"] |
| 52 | + api_groups = ["*"] |
| 53 | + } |
| 54 | +
|
| 55 | + rule { |
| 56 | + verbs = ["get", "list"] |
| 57 | + api_groups = ["*"] |
| 58 | + url_paths = ["/healthz"] |
| 59 | + } |
| 60 | + } |
| 61 | + } |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +<!-- schema generated by tfplugindocs --> |
| 66 | +## Schema |
| 67 | + |
| 68 | +### Required |
| 69 | + |
| 70 | +- `name` (String) The name of the iam role |
| 71 | +- `spec` (Block List, Min: 1, Max: 1) Spec block of iam role (see [below for nested schema](#nestedblock--spec)) |
| 72 | + |
| 73 | +### Optional |
| 74 | + |
| 75 | +- `meta` (Block List, Max: 1) Metadata for the resource (see [below for nested schema](#nestedblock--meta)) |
| 76 | + |
| 77 | +### Read-Only |
| 78 | + |
| 79 | +- `id` (String) The ID of this resource. |
| 80 | + |
| 81 | +<a id="nestedblock--spec"></a> |
| 82 | +### Nested Schema for `spec` |
| 83 | + |
| 84 | +Required: |
| 85 | + |
| 86 | +- `allowed_scopes` (List of String) The allowed scopes for the iam role. |
| 87 | +Valid values are (ORGANIZATION, MANAGEMENT_CLUSTER, PROVISIONER, CLUSTER_GROUP, CLUSTER, WORKSPACE, NAMESPACE) |
| 88 | + |
| 89 | +Optional: |
| 90 | + |
| 91 | +- `aggregation_rule` (Block List, Max: 1) Aggregation rules for the iam role. (see [below for nested schema](#nestedblock--spec--aggregation_rule)) |
| 92 | +- `is_deprecated` (Boolean) Flag representing whether role is deprecated. |
| 93 | +- `kubernetes_permissions` (Block List, Max: 1) Kubernetes permissions for the iam role. (see [below for nested schema](#nestedblock--spec--kubernetes_permissions)) |
| 94 | +- `tanzu_permissions` (List of String) Tanzu-specific permissions for the role. |
| 95 | + |
| 96 | +<a id="nestedblock--spec--aggregation_rule"></a> |
| 97 | +### Nested Schema for `spec.aggregation_rule` |
| 98 | + |
| 99 | +Required: |
| 100 | + |
| 101 | +- `cluster_role_selector` (Block List, Min: 1) Cluster role selector for the iam role. (see [below for nested schema](#nestedblock--spec--aggregation_rule--cluster_role_selector)) |
| 102 | + |
| 103 | +<a id="nestedblock--spec--aggregation_rule--cluster_role_selector"></a> |
| 104 | +### Nested Schema for `spec.aggregation_rule.cluster_role_selector` |
| 105 | + |
| 106 | +Optional: |
| 107 | + |
| 108 | +- `match_expression` (Block List) List of label selector requirements. |
| 109 | +The requirements are ANDed. (see [below for nested schema](#nestedblock--spec--aggregation_rule--cluster_role_selector--match_expression)) |
| 110 | +- `match_labels` (Map of String) Map of {key,value} pairs. |
| 111 | +A single {key,value} in the match_labels map is equivalent to an element of match_expression, whose key field is "key", the operator is "In", and the values array contains only "value". |
| 112 | +The requirements are ANDed. |
| 113 | + |
| 114 | +<a id="nestedblock--spec--aggregation_rule--cluster_role_selector--match_expression"></a> |
| 115 | +### Nested Schema for `spec.aggregation_rule.cluster_role_selector.match_expression` |
| 116 | + |
| 117 | +Required: |
| 118 | + |
| 119 | +- `key` (String) Key is the label key that the selector applies to. |
| 120 | +- `operator` (String) Operator represents a key's relationship to a set of values. |
| 121 | +Valid operators are "In", "NotIn", "Exists" and "DoesNotExist". |
| 122 | + |
| 123 | +Optional: |
| 124 | + |
| 125 | +- `values` (List of String) Values is an array of string values. |
| 126 | +If the operator is "In" or "NotIn", the values array must be non-empty. |
| 127 | +If the operator is "Exists" or "DoesNotExist", the values array must be empty. |
| 128 | +This array is replaced during a strategic merge patch. |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | +<a id="nestedblock--spec--kubernetes_permissions"></a> |
| 134 | +### Nested Schema for `spec.kubernetes_permissions` |
| 135 | + |
| 136 | +Required: |
| 137 | + |
| 138 | +- `rule` (Block List, Min: 1) Kubernetes rules. (see [below for nested schema](#nestedblock--spec--kubernetes_permissions--rule)) |
| 139 | + |
| 140 | +<a id="nestedblock--spec--kubernetes_permissions--rule"></a> |
| 141 | +### Nested Schema for `spec.kubernetes_permissions.rule` |
| 142 | + |
| 143 | +Required: |
| 144 | + |
| 145 | +- `verbs` (List of String) Verbs. |
| 146 | + |
| 147 | +Optional: |
| 148 | + |
| 149 | +- `api_groups` (List of String) API groups. |
| 150 | +- `resource_names` (List of String) Restricts the rule to resources by name. |
| 151 | +- `resources` (List of String) Resources for the role. |
| 152 | +- `url_paths` (List of String) Non-resource urls for the role. |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | +<a id="nestedblock--meta"></a> |
| 158 | +### Nested Schema for `meta` |
| 159 | + |
| 160 | +Optional: |
| 161 | + |
| 162 | +- `annotations` (Map of String) Annotations for the resource |
| 163 | +- `description` (String) Description of the resource |
| 164 | +- `labels` (Map of String) Labels for the resource |
| 165 | + |
| 166 | +Read-Only: |
| 167 | + |
| 168 | +- `resource_version` (String) Resource version of the resource |
| 169 | +- `uid` (String) UID of the resource |
0 commit comments