diff --git a/apis/cloudplatform/v1beta1/zz_generated.deepcopy.go b/apis/cloudplatform/v1beta1/zz_generated.deepcopy.go index 0f7f20511..b4a062a3f 100644 --- a/apis/cloudplatform/v1beta1/zz_generated.deepcopy.go +++ b/apis/cloudplatform/v1beta1/zz_generated.deepcopy.go @@ -1367,6 +1367,149 @@ func (in *ProjectIAMMemberStatus) DeepCopy() *ProjectIAMMemberStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectIAMPolicy) DeepCopyInto(out *ProjectIAMPolicy) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectIAMPolicy. +func (in *ProjectIAMPolicy) DeepCopy() *ProjectIAMPolicy { + if in == nil { + return nil + } + out := new(ProjectIAMPolicy) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectIAMPolicy) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectIAMPolicyList) DeepCopyInto(out *ProjectIAMPolicyList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ProjectIAMPolicy, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectIAMPolicyList. +func (in *ProjectIAMPolicyList) DeepCopy() *ProjectIAMPolicyList { + if in == nil { + return nil + } + out := new(ProjectIAMPolicyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ProjectIAMPolicyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectIAMPolicyObservation) DeepCopyInto(out *ProjectIAMPolicyObservation) { + *out = *in + if in.Etag != nil { + in, out := &in.Etag, &out.Etag + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectIAMPolicyObservation. +func (in *ProjectIAMPolicyObservation) DeepCopy() *ProjectIAMPolicyObservation { + if in == nil { + return nil + } + out := new(ProjectIAMPolicyObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectIAMPolicyParameters) DeepCopyInto(out *ProjectIAMPolicyParameters) { + *out = *in + if in.PolicyData != nil { + in, out := &in.PolicyData, &out.PolicyData + *out = new(string) + **out = **in + } + if in.Project != nil { + in, out := &in.Project, &out.Project + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectIAMPolicyParameters. +func (in *ProjectIAMPolicyParameters) DeepCopy() *ProjectIAMPolicyParameters { + if in == nil { + return nil + } + out := new(ProjectIAMPolicyParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectIAMPolicySpec) DeepCopyInto(out *ProjectIAMPolicySpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectIAMPolicySpec. +func (in *ProjectIAMPolicySpec) DeepCopy() *ProjectIAMPolicySpec { + if in == nil { + return nil + } + out := new(ProjectIAMPolicySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ProjectIAMPolicyStatus) DeepCopyInto(out *ProjectIAMPolicyStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProjectIAMPolicyStatus. +func (in *ProjectIAMPolicyStatus) DeepCopy() *ProjectIAMPolicyStatus { + if in == nil { + return nil + } + out := new(ProjectIAMPolicyStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ProjectList) DeepCopyInto(out *ProjectList) { *out = *in diff --git a/apis/cloudplatform/v1beta1/zz_generated.managed.go b/apis/cloudplatform/v1beta1/zz_generated.managed.go index 63ef076ff..512ff5ad5 100644 --- a/apis/cloudplatform/v1beta1/zz_generated.managed.go +++ b/apis/cloudplatform/v1beta1/zz_generated.managed.go @@ -547,6 +547,72 @@ func (mg *ProjectIAMMember) SetWriteConnectionSecretToReference(r *xpv1.SecretRe mg.Spec.WriteConnectionSecretToReference = r } +// GetCondition of this ProjectIAMPolicy. +func (mg *ProjectIAMPolicy) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this ProjectIAMPolicy. +func (mg *ProjectIAMPolicy) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetProviderConfigReference of this ProjectIAMPolicy. +func (mg *ProjectIAMPolicy) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +/* +GetProviderReference of this ProjectIAMPolicy. +Deprecated: Use GetProviderConfigReference. +*/ +func (mg *ProjectIAMPolicy) GetProviderReference() *xpv1.Reference { + return mg.Spec.ProviderReference +} + +// GetPublishConnectionDetailsTo of this ProjectIAMPolicy. +func (mg *ProjectIAMPolicy) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this ProjectIAMPolicy. +func (mg *ProjectIAMPolicy) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this ProjectIAMPolicy. +func (mg *ProjectIAMPolicy) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this ProjectIAMPolicy. +func (mg *ProjectIAMPolicy) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetProviderConfigReference of this ProjectIAMPolicy. +func (mg *ProjectIAMPolicy) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +/* +SetProviderReference of this ProjectIAMPolicy. +Deprecated: Use SetProviderConfigReference. +*/ +func (mg *ProjectIAMPolicy) SetProviderReference(r *xpv1.Reference) { + mg.Spec.ProviderReference = r +} + +// SetPublishConnectionDetailsTo of this ProjectIAMPolicy. +func (mg *ProjectIAMPolicy) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this ProjectIAMPolicy. +func (mg *ProjectIAMPolicy) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} + // GetCondition of this ProjectService. func (mg *ProjectService) GetCondition(ct xpv1.ConditionType) xpv1.Condition { return mg.Status.GetCondition(ct) diff --git a/apis/cloudplatform/v1beta1/zz_generated.managedlist.go b/apis/cloudplatform/v1beta1/zz_generated.managedlist.go index 5cc24a1c6..1f7587430 100644 --- a/apis/cloudplatform/v1beta1/zz_generated.managedlist.go +++ b/apis/cloudplatform/v1beta1/zz_generated.managedlist.go @@ -82,6 +82,15 @@ func (l *ProjectIAMMemberList) GetItems() []resource.Managed { return items } +// GetItems of this ProjectIAMPolicyList. +func (l *ProjectIAMPolicyList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} + // GetItems of this ProjectList. func (l *ProjectList) GetItems() []resource.Managed { items := make([]resource.Managed, len(l.Items)) diff --git a/apis/cloudplatform/v1beta1/zz_generated_terraformed.go b/apis/cloudplatform/v1beta1/zz_generated_terraformed.go index e917a05e8..b415c8aea 100755 --- a/apis/cloudplatform/v1beta1/zz_generated_terraformed.go +++ b/apis/cloudplatform/v1beta1/zz_generated_terraformed.go @@ -617,6 +617,80 @@ func (tr *ProjectIAMMember) GetTerraformSchemaVersion() int { return 0 } +// GetTerraformResourceType returns Terraform resource type for this ProjectIAMPolicy +func (mg *ProjectIAMPolicy) GetTerraformResourceType() string { + return "google_project_iam_policy" +} + +// GetConnectionDetailsMapping for this ProjectIAMPolicy +func (tr *ProjectIAMPolicy) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this ProjectIAMPolicy +func (tr *ProjectIAMPolicy) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this ProjectIAMPolicy +func (tr *ProjectIAMPolicy) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this ProjectIAMPolicy +func (tr *ProjectIAMPolicy) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this ProjectIAMPolicy +func (tr *ProjectIAMPolicy) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this ProjectIAMPolicy +func (tr *ProjectIAMPolicy) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// LateInitialize this ProjectIAMPolicy using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *ProjectIAMPolicy) LateInitialize(attrs []byte) (bool, error) { + params := &ProjectIAMPolicyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *ProjectIAMPolicy) GetTerraformSchemaVersion() int { + return 0 +} + // GetTerraformResourceType returns Terraform resource type for this ProjectService func (mg *ProjectService) GetTerraformResourceType() string { return "google_project_service" diff --git a/apis/cloudplatform/v1beta1/zz_projectiampolicy_types.go b/apis/cloudplatform/v1beta1/zz_projectiampolicy_types.go new file mode 100755 index 000000000..84f2315ec --- /dev/null +++ b/apis/cloudplatform/v1beta1/zz_projectiampolicy_types.go @@ -0,0 +1,97 @@ +/* +Copyright 2021 The Crossplane Authors. + +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. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + + v1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +) + +type ProjectIAMPolicyObservation struct { + + // (Computed) The etag of the project's IAM policy. + Etag *string `json:"etag,omitempty" tf:"etag,omitempty"` + + ID *string `json:"id,omitempty" tf:"id,omitempty"` +} + +type ProjectIAMPolicyParameters struct { + + // The google_iam_policy data source that represents + // the IAM policy that will be applied to the project. The policy will be + // merged with any existing policy applied to the project. + // +kubebuilder:validation:Required + PolicyData *string `json:"policyData" tf:"policy_data,omitempty"` + + // The project id of the target project. This is not + // inferred from the provider. + // +kubebuilder:validation:Required + Project *string `json:"project" tf:"project,omitempty"` +} + +// ProjectIAMPolicySpec defines the desired state of ProjectIAMPolicy +type ProjectIAMPolicySpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider ProjectIAMPolicyParameters `json:"forProvider"` +} + +// ProjectIAMPolicyStatus defines the observed state of ProjectIAMPolicy. +type ProjectIAMPolicyStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider ProjectIAMPolicyObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true + +// ProjectIAMPolicy is the Schema for the ProjectIAMPolicys API. Collection of resources to manage IAM policy for a project. +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,gcp} +type ProjectIAMPolicy struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec ProjectIAMPolicySpec `json:"spec"` + Status ProjectIAMPolicyStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// ProjectIAMPolicyList contains a list of ProjectIAMPolicys +type ProjectIAMPolicyList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []ProjectIAMPolicy `json:"items"` +} + +// Repository type metadata. +var ( + ProjectIAMPolicy_Kind = "ProjectIAMPolicy" + ProjectIAMPolicy_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: ProjectIAMPolicy_Kind}.String() + ProjectIAMPolicy_KindAPIVersion = ProjectIAMPolicy_Kind + "." + CRDGroupVersion.String() + ProjectIAMPolicy_GroupVersionKind = CRDGroupVersion.WithKind(ProjectIAMPolicy_Kind) +) + +func init() { + SchemeBuilder.Register(&ProjectIAMPolicy{}, &ProjectIAMPolicyList{}) +} diff --git a/apis/compute/v1beta1/zz_generated.deepcopy.go b/apis/compute/v1beta1/zz_generated.deepcopy.go index dfb11a806..4bfac95e5 100644 --- a/apis/compute/v1beta1/zz_generated.deepcopy.go +++ b/apis/compute/v1beta1/zz_generated.deepcopy.go @@ -26841,6 +26841,11 @@ func (in *RouterInterfaceParameters) DeepCopyInto(out *RouterInterfaceParameters *out = new(string) **out = **in } + if in.VPNTunnel2 != nil { + in, out := &in.VPNTunnel2, &out.VPNTunnel2 + *out = new(string) + **out = **in + } if in.VPNTunnelRef != nil { in, out := &in.VPNTunnelRef, &out.VPNTunnelRef *out = new(v1.Reference) diff --git a/apis/compute/v1beta1/zz_network_types.go b/apis/compute/v1beta1/zz_network_types.go index e580b02e7..679032003 100755 --- a/apis/compute/v1beta1/zz_network_types.go +++ b/apis/compute/v1beta1/zz_network_types.go @@ -45,8 +45,8 @@ type NetworkParameters struct { // 10.128.0.0/9 address range. // When set to false, the network is created in "custom subnet mode" so // the user can explicitly connect subnetwork resources. - // +kubebuilder:validation:Optional - AutoCreateSubnetworks *bool `json:"autoCreateSubnetworks,omitempty" tf:"auto_create_subnetworks,omitempty"` + // +kubebuilder:validation:Required + AutoCreateSubnetworks *bool `json:"autoCreateSubnetworks" tf:"auto_create_subnetworks,omitempty"` // If set to true, default routes (0.0.0.0/0) will be deleted // immediately after network creation. Defaults to false. diff --git a/apis/compute/v1beta1/zz_routerinterface_types.go b/apis/compute/v1beta1/zz_routerinterface_types.go index 1e900d0fc..b5f62822c 100755 --- a/apis/compute/v1beta1/zz_routerinterface_types.go +++ b/apis/compute/v1beta1/zz_routerinterface_types.go @@ -82,6 +82,9 @@ type RouterInterfaceParameters struct { // +kubebuilder:validation:Optional VPNTunnel *string `json:"vpnTunnel,omitempty" tf:"vpn_tunnel,omitempty"` + // +kubebuilder:validation:Optional + VPNTunnel2 *string `json:"vpnTunnel2,omitempty" tf:"vpn_tunnel2,omitempty"` + // Reference to a VPNTunnel to populate vpnTunnel. // +kubebuilder:validation:Optional VPNTunnelRef *v1.Reference `json:"vpnTunnelRef,omitempty" tf:"-"` diff --git a/config/compute/config.go b/config/compute/config.go index a4e5124a4..704ad7224 100644 --- a/config/compute/config.go +++ b/config/compute/config.go @@ -398,15 +398,6 @@ func Configure(p *config.Provider) { //nolint: gocyclo } }) - p.AddResourceConfigurator("google_compute_router_interface", func(r *config.Resource) { - r.References["router"] = config.Reference{ - Type: "Router", - } - r.References["vpn_tunnel"] = config.Reference{ - Type: "VPNTunnel", - } - }) - p.AddResourceConfigurator("google_compute_vpn_gateway", func(r *config.Resource) { config.MarkAsRequired(r.TerraformResource, "region") }) @@ -427,6 +418,22 @@ func Configure(p *config.Provider) { //nolint: gocyclo p.AddResourceConfigurator("google_compute_project_metadata_item", func(r *config.Resource) { r.MetaResource.ArgumentDocs["id"] = "an identifier for the resource with format `{{key}}`" }) + + p.AddResourceConfigurator("google_compute_router_interface", func(r *config.Resource) { + r.References["router"] = config.Reference{ + Type: "Router", + } + r.References["vpn_tunnel"] = config.Reference{ + Type: "VPNTunnel", + } + + r.TerraformResource.Schema["vpn_tunnel2"] = r.TerraformResource.Schema["vpn_tunnel"] + }) + + p.AddResourceConfigurator("google_compute_network", func(r *config.Resource) { + r.TerraformResource.Schema["auto_create_subnetworks"].Required = true + r.TerraformResource.Schema["auto_create_subnetworks"].Optional = false + }) } // InstanceGroupExtractor extracts Instance Group from diff --git a/config/external_name.go b/config/external_name.go index 5c45dff5b..98c0ca543 100644 --- a/config/external_name.go +++ b/config/external_name.go @@ -624,6 +624,8 @@ var externalNameConfigs = map[string]config.ExternalName{ // // This resource does not support import. "google_dataflow_job": config.IdentifierFromProvider, + + "google_project_iam_policy": config.IdentifierFromProvider, } // TemplatedStringAsIdentifierWithNoName uses TemplatedStringAsIdentifier but diff --git a/config/provider.go b/config/provider.go index edeaf3b10..f91460a52 100644 --- a/config/provider.go +++ b/config/provider.go @@ -90,7 +90,6 @@ var skipList = []string{ "google_compute_region_disk_iam_binding", // Note(donovamuller): Following resources are potentially dangerous to implement // details in: https://github.com/upbound/official-providers/issues/521 - "google_project_iam_policy", "google_project_iam_binding", "google_organization_iam_binding", "google_service_account_iam_policy", diff --git a/examples-generated/cloudplatform/projectiampolicy.yaml b/examples-generated/cloudplatform/projectiampolicy.yaml new file mode 100644 index 000000000..a7204657a --- /dev/null +++ b/examples-generated/cloudplatform/projectiampolicy.yaml @@ -0,0 +1,15 @@ +apiVersion: cloudplatform.gcp.upbound.io/v1beta1 +kind: ProjectIAMPolicy +metadata: + annotations: + meta.upbound.io/example-id: cloudplatform/v1beta1/projectiampolicy + labels: + testing.upbound.io/example-name: project + name: project +spec: + forProvider: + policyData: ${data.google_iam_policy.admin.policy_data} + project: your-project-id + +--- + diff --git a/internal/controller/cloudplatform/projectiampolicy/zz_controller.go b/internal/controller/cloudplatform/projectiampolicy/zz_controller.go new file mode 100755 index 000000000..921474a80 --- /dev/null +++ b/internal/controller/cloudplatform/projectiampolicy/zz_controller.go @@ -0,0 +1,63 @@ +/* +Copyright 2021 The Crossplane Authors. + +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. +*/ + +// Code generated by upjet. DO NOT EDIT. + +package projectiampolicy + +import ( + "time" + + "github.com/crossplane/crossplane-runtime/pkg/connection" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + tjcontroller "github.com/upbound/upjet/pkg/controller" + "github.com/upbound/upjet/pkg/terraform" + ctrl "sigs.k8s.io/controller-runtime" + + v1beta1 "github.com/upbound/provider-gcp/apis/cloudplatform/v1beta1" +) + +// Setup adds a controller that reconciles ProjectIAMPolicy managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1beta1.ProjectIAMPolicy_GroupVersionKind.String()) + var initializers managed.InitializerChain + cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} + if o.SecretStoreConfigGVK != nil { + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK)) + } + r := managed.NewReconciler(mgr, + xpresource.ManagedKind(v1beta1.ProjectIAMPolicy_GroupVersionKind), + managed.WithExternalConnecter(tjcontroller.NewConnector(mgr.GetClient(), o.WorkspaceStore, o.SetupFn, o.Provider.Resources["google_project_iam_policy"], + tjcontroller.WithCallbackProvider(tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.ProjectIAMPolicy_GroupVersionKind))), + )), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(terraform.NewWorkspaceFinalizer(o.WorkspaceStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3*time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + ) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + For(&v1beta1.ProjectIAMPolicy{}). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/zz_setup.go b/internal/controller/zz_setup.go index 862a05479..778d8c4e9 100755 --- a/internal/controller/zz_setup.go +++ b/internal/controller/zz_setup.go @@ -35,6 +35,7 @@ import ( projectdefaultserviceaccounts "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectdefaultserviceaccounts" projectiamauditconfig "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectiamauditconfig" projectiammember "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectiammember" + projectiampolicy "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectiampolicy" projectservice "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectservice" projectusageexportbucket "github.com/upbound/provider-gcp/internal/controller/cloudplatform/projectusageexportbucket" serviceaccount "github.com/upbound/provider-gcp/internal/controller/cloudplatform/serviceaccount" @@ -255,6 +256,7 @@ func Setup(mgr ctrl.Manager, o controller.Options) error { projectdefaultserviceaccounts.Setup, projectiamauditconfig.Setup, projectiammember.Setup, + projectiampolicy.Setup, projectservice.Setup, projectusageexportbucket.Setup, serviceaccount.Setup, diff --git a/package/crds/cloudplatform.gcp.upbound.io_projectiampolicies.yaml b/package/crds/cloudplatform.gcp.upbound.io_projectiampolicies.yaml new file mode 100644 index 000000000..ccaaf5426 --- /dev/null +++ b/package/crds/cloudplatform.gcp.upbound.io_projectiampolicies.yaml @@ -0,0 +1,308 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.8.0 + creationTimestamp: null + name: projectiampolicies.cloudplatform.gcp.upbound.io +spec: + group: cloudplatform.gcp.upbound.io + names: + categories: + - crossplane + - managed + - gcp + kind: ProjectIAMPolicy + listKind: ProjectIAMPolicyList + plural: projectiampolicies + singular: projectiampolicy + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: ProjectIAMPolicy is the Schema for the ProjectIAMPolicys API. + Collection of resources to manage IAM policy for a project. + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: ProjectIAMPolicySpec defines the desired state of ProjectIAMPolicy + properties: + deletionPolicy: + default: Delete + description: DeletionPolicy specifies what will happen to the underlying + external when this managed resource is deleted - either "Delete" + or "Orphan" the external resource. + enum: + - Orphan + - Delete + type: string + forProvider: + properties: + policyData: + description: The google_iam_policy data source that represents + the IAM policy that will be applied to the project. The policy + will be merged with any existing policy applied to the project. + type: string + project: + description: The project id of the target project. This is not + inferred from the provider. + type: string + required: + - policyData + - project + type: object + providerConfigRef: + default: + name: default + description: ProviderConfigReference specifies how the provider that + will be used to create, observe, update, and delete this managed + resource should be configured. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of this + reference is required. The default is 'Required', which + means the reconcile will fail if the reference cannot be + resolved. 'Optional' means this reference will be a no-op + if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will attempt + to resolve the reference only when the corresponding field + is not present. Use 'Always' to resolve the reference on + every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + providerRef: + description: 'ProviderReference specifies the provider that will be + used to create, observe, update, and delete this managed resource. + Deprecated: Please use ProviderConfigReference, i.e. `providerConfigRef`' + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of this + reference is required. The default is 'Required', which + means the reconcile will fail if the reference cannot be + resolved. 'Optional' means this reference will be a no-op + if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will attempt + to resolve the reference only when the corresponding field + is not present. Use 'Always' to resolve the reference on + every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + publishConnectionDetailsTo: + description: PublishConnectionDetailsTo specifies the connection secret + config which contains a name, metadata and a reference to secret + store config to which any connection details for this managed resource + should be written. Connection details frequently include the endpoint, + username, and password required to connect to the managed resource. + properties: + configRef: + default: + name: default + description: SecretStoreConfigRef specifies which secret store + config should be used for this ConnectionSecret. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: Resolution specifies whether resolution of + this reference is required. The default is 'Required', + which means the reconcile will fail if the reference + cannot be resolved. 'Optional' means this reference + will be a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: Resolve specifies when this reference should + be resolved. The default is 'IfNotPresent', which will + attempt to resolve the reference only when the corresponding + field is not present. Use 'Always' to resolve the reference + on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + metadata: + description: Metadata is the metadata for connection secret. + properties: + annotations: + additionalProperties: + type: string + description: Annotations are the annotations to be added to + connection secret. - For Kubernetes secrets, this will be + used as "metadata.annotations". - It is up to Secret Store + implementation for others store types. + type: object + labels: + additionalProperties: + type: string + description: Labels are the labels/tags to be added to connection + secret. - For Kubernetes secrets, this will be used as "metadata.labels". + - It is up to Secret Store implementation for others store + types. + type: object + type: + description: Type is the SecretType for the connection secret. + - Only valid for Kubernetes Secret Stores. + type: string + type: object + name: + description: Name is the name of the connection secret. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the namespace + and name of a Secret to which any connection details for this managed + resource should be written. Connection details frequently include + the endpoint, username, and password required to connect to the + managed resource. This field is planned to be replaced in a future + release in favor of PublishConnectionDetailsTo. Currently, both + could be set independently and connection details would be published + to both without affecting each other. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + status: + description: ProjectIAMPolicyStatus defines the observed state of ProjectIAMPolicy. + properties: + atProvider: + properties: + etag: + description: (Computed) The etag of the project's IAM policy. + type: string + id: + type: string + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: LastTransitionTime is the last time this condition + transitioned from one status to another. + format: date-time + type: string + message: + description: A Message containing details about this condition's + last transition from one status to another, if any. + type: string + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: Type of this condition. At most one of each condition + type may apply to a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/package/crds/compute.gcp.upbound.io_networks.yaml b/package/crds/compute.gcp.upbound.io_networks.yaml index 3100461bb..97aaa5d1c 100644 --- a/package/crds/compute.gcp.upbound.io_networks.yaml +++ b/package/crds/compute.gcp.upbound.io_networks.yaml @@ -95,6 +95,8 @@ spec: routes with all subnetworks of this network, across regions. Possible values are REGIONAL and GLOBAL. type: string + required: + - autoCreateSubnetworks type: object providerConfigRef: default: diff --git a/package/crds/compute.gcp.upbound.io_routerinterfaces.yaml b/package/crds/compute.gcp.upbound.io_routerinterfaces.yaml index 39cf65cde..f5e2a49af 100644 --- a/package/crds/compute.gcp.upbound.io_routerinterfaces.yaml +++ b/package/crds/compute.gcp.upbound.io_routerinterfaces.yaml @@ -172,6 +172,8 @@ spec: to be created. Only one of vpn_tunnel and interconnect_attachment can be specified. type: string + vpnTunnel2: + type: string vpnTunnelRef: description: Reference to a VPNTunnel to populate vpnTunnel. properties: