Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding TF support for Tenancy APIs for Membership RBAC Role Bindings #8440

Merged
merged 24 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
85298f1
Adding Terraform resources for Tenancy APIs in GKEHub
sahsagar-google Jul 19, 2023
05f9e1d
Merge branch 'GoogleCloudPlatform:main' into main
sahsagar-google Jul 20, 2023
d056843
Merge branch 'GoogleCloudPlatform:main' into main
sahsagar-google Jul 24, 2023
864c3ee
Adding TF support for Tenancy APIs for Membership RBAC Role Bindings
sahsagar-google Jul 24, 2023
20fea52
Segregating MembershipBinding and MembershipRBACRoleBinding to keep t…
sahsagar-google Jul 24, 2023
672494c
Merge branch 'GoogleCloudPlatform:main' into main
sahsagar-google Aug 2, 2023
3a4cefa
Merge branch 'GoogleCloudPlatform:main' into main
sahsagar-google Aug 10, 2023
693aaff
Fixing the docu URIs
sahsagar-google Aug 10, 2023
1d65988
Merge branch 'GoogleCloudPlatform:main' into main
sahsagar-google Aug 11, 2023
6ea5ec4
Removing the updat-ability from Membership RBAC Role Binding
sahsagar-google Aug 11, 2023
d783ddd
Merge branch 'GoogleCloudPlatform:main' into main
sahsagar-google Aug 11, 2023
bc96cbb
Adding TF support for Tenancy API for Membership Binding
sahsagar-google Jul 24, 2023
f74ce0f
Adding dependent membership binding to the same commit chain
sahsagar-google Aug 11, 2023
d594f1a
Replacing hard coded project number with the project number from the …
sahsagar-google Aug 12, 2023
e0c2212
Making Scope un-updatable and replacing hard coded project number wit…
sahsagar-google Aug 12, 2023
c77f8b2
Merge branch 'GoogleCloudPlatform:main' into main
sahsagar-google Aug 14, 2023
71c92e6
Making Scope RRBAC updatable
sahsagar-google Aug 15, 2023
2403caa
Merge branch 'GoogleCloudPlatform:main' into main
sahsagar-google Aug 15, 2023
a986e5d
Merge remote-tracking branch 'origin/main' into mrbac
sahsagar-google Aug 15, 2023
46acacd
Removing new resources from this branch
sahsagar-google Aug 15, 2023
308091c
Merge branch 'GoogleCloudPlatform:main' into main
sahsagar-google Aug 15, 2023
8401cc2
Allow specifying global L7 ILB in dns_record_set routing policy (#8470)
hkundag Aug 15, 2023
a0f99d5
Merge branch 'GoogleCloudPlatform:main' into main
sahsagar-google Aug 15, 2023
4ffe308
Merge remote-tracking branch 'origin/main' into mrbac
sahsagar-google Aug 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 161 additions & 0 deletions mmv1/products/gkehub2/MembershipRBACRoleBinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
# Copyright 2023 Google Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

--- !ruby/object:Api::Resource
name: 'MembershipRBACRoleBinding'
base_url: 'projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/rbacrolebindings'
create_url: 'projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/rbacrolebindings/?rbacrolebinding_id={{membership_rbac_role_binding_id}}'
update_url: 'projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/rbacrolebindings/{{membership_rbac_role_binding_id}}'
sahsagar-google marked this conversation as resolved.
Show resolved Hide resolved
self_link: 'projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/rbacrolebindings/{{membership_rbac_role_binding_id}}'
update_verb: :PATCH
update_mask: true
description: |
RBACRoleBinding represents a rbacrolebinding across the Fleet.
references: !ruby/object:Api::Resource::ReferenceLinks
guides:
'Registering a Cluster': 'https://cloud.google.com/anthos/multicluster-management/connect/registering-a-cluster#register_cluster'
api: 'https://cloud.google.com/anthos/fleet-management/docs/reference/rest/v1/projects.locations.memberships'
async: !ruby/object:Api::OpAsync
operation: !ruby/object:Api::OpAsync::Operation
kind: 'gkehub#operation'
path: 'name'
base_url: '{{op_id}}'
wait_ms: 1000
result: !ruby/object:Api::OpAsync::Result
path: 'response'
resource_inside_response: true
status: !ruby/object:Api::OpAsync::Status
path: 'done'
complete: 'true'
allowed:
- 'true'
- 'false'
error: !ruby/object:Api::OpAsync::Error
path: 'error/errors'
message: 'message'
autogen_async: true
examples:
- !ruby/object:Provider::Terraform::Examples
name: 'gkehub_membership_rbac_role_binding_basic'
primary_resource_name: 'fmt.Sprintf(\"tf-test-membership%s\", context[\"random_suffix\"]), fmt.Sprintf(\"tf-test-rbac-role-binding%s\", context[\"random_suffix\"])'
primary_resource_id: 'membershiprbacrolebinding'
vars:
cluster_name: "basiccluster"
test_env_vars:
project: :PROJECT_NAME
location: 'global'
# Skip sweeper gen since this is a child resource.
skip_sweeper: true
id_format: 'projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/rbacrolebindings/{{membership_rbac_role_binding_id}}'
import_format:
['projects/{{project}}/locations/{{location}}/memberships/{{membership_id}}/rbacrolebindings/{{membership_rbac_role_binding_id}}']
parameters:
- !ruby/object:Api::Type::String
name: 'membership_id'
required: true
immutable: true
url_param_only: true
description: |
Id of the membership
- !ruby/object:Api::Type::String
name: 'location'
required: true
immutable: true
url_param_only: true
description: |
Location of the Membership
properties:
- !ruby/object:Api::Type::String
name: 'membershipRbacRoleBindingId'
description: |
The client-provided identifier of the RBAC Role Binding.
required: true
immutable: true
url_param_only: true
- !ruby/object:Api::Type::String
name: 'name'
output: true
description: |
The resource name for the RBAC Role Binding
- !ruby/object:Api::Type::String
name: 'uid'
output: true
description: |
Google-generated UUID for this resource.
- !ruby/object:Api::Type::Time
name: 'createTime'
description: |
Time the RBAC Role Binding was created in UTC.
output: true
- !ruby/object:Api::Type::Time
name: 'updateTime'
description: |
Time the RBAC Role Binding was updated in UTC.
output: true
- !ruby/object:Api::Type::Time
name: 'deleteTime'
description: |
Time the RBAC Role Binding was deleted in UTC.
output: true
- !ruby/object:Api::Type::NestedObject
name: 'state'
description: |
State of the RBAC Role Binding resource.
output: true
properties:
- !ruby/object:Api::Type::Enum
name: 'code'
description: |
Code describes the state of a RBAC Role Binding resource.
output: true
values:
- :CODE_UNSPECIFIED
- :CREATING
- :READY
- :DELETING
- :UPDATING
- !ruby/object:Api::Type::String
name: 'user'
description: |
Principal that is be authorized in the cluster (at least of one the oneof
is required). Updating one will unset the other automatically.
user is the name of the user as seen by the kubernetes cluster, example
"alice" or "[email protected]"
exactly_one_of:
- user
- group
- !ruby/object:Api::Type::String
name: 'group'
description: |
Principal that is be authorized in the cluster (at least of one the oneof
is required). Updating one will unset the other automatically.
group is the group, as seen by the kubernetes cluster.
exactly_one_of:
- user
- group
sahsagar-google marked this conversation as resolved.
Show resolved Hide resolved
- !ruby/object:Api::Type::NestedObject
name: 'role'
description: |
Role to bind to the principal.
required: true
properties:
- !ruby/object:Api::Type::Enum
name: 'predefinedRole'
description: |
PredefinedRole is an ENUM representation of the default Kubernetes Roles
values:
sahsagar-google marked this conversation as resolved.
Show resolved Hide resolved
- :UNKNOWN
- :ADMIN
- :EDIT
- :VIEW
- :ANTHOS_SUPPORT
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
resource "google_container_cluster" "primary" {
name = "<%= ctx[:vars]['cluster_name'] %>"
location = "us-central1-a"
initial_node_count = 1
}

resource "google_gke_hub_membership" "<%= ctx[:primary_resource_id] %>" {
membership_id = "tf-test-membership%{random_suffix}"
endpoint {
gke_cluster {
resource_link = "//container.googleapis.com/${google_container_cluster.primary.id}"
}
}

depends_on = [google_container_cluster.primary]
}

resource "google_gke_hub_membership_rbac_role_binding" "<%= ctx[:primary_resource_id] %>" {
membership_rbac_role_binding_id = "tf-test-membership-rbac-role-binding%{random_suffix}"
membership_id = "tf-test-membership%{random_suffix}"
user = "service-155926358489@gcp-sa-anthossupport.iam.gserviceaccount.com"
sahsagar-google marked this conversation as resolved.
Show resolved Hide resolved
role {
predefined_role = "ANTHOS_SUPPORT"
}
location = "global"
depends_on = [google_gke_hub_membership.<%= ctx[:primary_resource_id] %>]
}