From 175a6b04648bef1b7cfc6d32a0e62d06380d8d15 Mon Sep 17 00:00:00 2001 From: justinsb Date: Sun, 15 Oct 2023 20:01:53 -0400 Subject: [PATCH 1/4] mockgcp: implement compute instance resource And stub a few supporting resources (images, zones) --- config/tests/samples/create/harness.go | 1 + mockgcp/mock_http_roundtrip.go | 67 +++-- mockgcp/mockcompute/disksv1.go | 14 + mockgcp/mockcompute/imagesv1.go | 60 +++++ mockgcp/mockcompute/instancesv1.go | 356 +++++++++++++++++++++++++ mockgcp/mockcompute/regionaladdress.go | 1 + mockgcp/mockcompute/service.go | 16 ++ mockgcp/mockcompute/zonesv1.go | 84 ++++++ 8 files changed, 579 insertions(+), 20 deletions(-) create mode 100644 mockgcp/mockcompute/imagesv1.go create mode 100644 mockgcp/mockcompute/instancesv1.go create mode 100644 mockgcp/mockcompute/zonesv1.go diff --git a/config/tests/samples/create/harness.go b/config/tests/samples/create/harness.go index c0b2aa1f65..4a30ed5d9a 100644 --- a/config/tests/samples/create/harness.go +++ b/config/tests/samples/create/harness.go @@ -649,6 +649,7 @@ func MaybeSkip(t *testing.T, name string, resources []*unstructured.Unstructured case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeAddress"}: case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeDisk"}: case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeHealthCheck"}: + case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeInstance"}: case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeNetwork"}: case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeNodeGroup"}: case schema.GroupKind{Group: "compute.cnrm.cloud.google.com", Kind: "ComputeNodeTemplate"}: diff --git a/mockgcp/mock_http_roundtrip.go b/mockgcp/mock_http_roundtrip.go index d7e730ffb4..7941c53b5b 100644 --- a/mockgcp/mock_http_roundtrip.go +++ b/mockgcp/mock_http_roundtrip.go @@ -215,14 +215,27 @@ func (m *mockRoundTripper) prefilterRequest(req *http.Request) error { return fmt.Errorf("error reading request body: %w", err) } - s := requestBody.String() + if requestBody.Len() != 0 { + o := make(map[string]any) + if err := json.Unmarshal(requestBody.Bytes(), &o); err != nil { + return fmt.Errorf("parsing json: %w", err) + } - s, err := m.modifyUpdateMask(s) - if err != nil { - return err - } + if err := m.modifyUpdateMask(o); err != nil { + return err + } - req.Body = io.NopCloser(strings.NewReader(s)) + if err := pruneNilArrays(o); err != nil { + return err + } + + b, err := json.Marshal(o) + if err != nil { + return fmt.Errorf("building json: %w", err) + } + + req.Body = io.NopCloser(bytes.NewBuffer(b)) + } } return nil } @@ -233,16 +246,7 @@ func (m *mockRoundTripper) prefilterRequest(req *http.Request) error { // However, because GCP APIs seem to accept display_name or displayName over JSON. // If we don't map display_name => displayName, the proto validation will reject it. // e.g. https://github.com/grpc-ecosystem/grpc-gateway/issues/2239 -func (m *mockRoundTripper) modifyUpdateMask(s string) (string, error) { - if len(s) == 0 { - return "", nil - } - - o := make(map[string]any) - if err := json.Unmarshal([]byte(s), &o); err != nil { - return "", fmt.Errorf("parsing json: %w", err) - } - +func (m *mockRoundTripper) modifyUpdateMask(o map[string]any) error { for k, v := range o { switch k { case "updateMask": @@ -257,11 +261,34 @@ func (m *mockRoundTripper) modifyUpdateMask(s string) (string, error) { o[k] = strings.Join(tokens, ",") } } - b, err := json.Marshal(o) - if err != nil { - return "", fmt.Errorf("building json: %w", err) + + return nil +} + +// pruneNilArrays replaces [nil] => [] +// For some reason terraform sends [nil], which is not really valid +func pruneNilArrays(o map[string]any) error { + for k, v := range o { + if v == nil { + continue + } + switch v := v.(type) { + case map[string]any: + if err := pruneNilArrays(v); err != nil { + return err + } + case []any: + if len(v) == 1 && v[0] == nil { + o[k] = []any{} + } + case string, int64, bool, float64: + // ignore + default: + return fmt.Errorf("unhandled type %T", v) + } } - return string(b), nil + + return nil } // roundTripIAMPolicy serves the IAM policy verbs (e.g. :getIamPolicy) diff --git a/mockgcp/mockcompute/disksv1.go b/mockgcp/mockcompute/disksv1.go index e56e6a2618..fa9f5645c3 100644 --- a/mockgcp/mockcompute/disksv1.go +++ b/mockgcp/mockcompute/disksv1.go @@ -75,6 +75,20 @@ func (s *DisksV1) Insert(ctx context.Context, req *pb.InsertDiskRequest) (*pb.Op obj.PhysicalBlockSizeBytes = PtrTo(int64(4096)) } + if obj.SourceImage != nil { + tokens := strings.Split(*obj.SourceImage, "/") + if len(tokens) == 2 { + // debian-cloud/debian-11 + obj.SourceImage = PtrTo("https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010") + obj.SourceImageId = PtrTo("2443108620951880213") + } + if len(tokens) == 6 { + // projects/debian-cloud/global/images/family/debian-11 + obj.SourceImage = PtrTo("https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010") + obj.SourceImageId = PtrTo("2443108620951880213") + } + } + if err := s.storage.Create(ctx, fqn, obj); err != nil { return nil, err } diff --git a/mockgcp/mockcompute/imagesv1.go b/mockgcp/mockcompute/imagesv1.go new file mode 100644 index 0000000000..c05933f76b --- /dev/null +++ b/mockgcp/mockcompute/imagesv1.go @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC +// +// 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. + +package mockcompute + +import ( + "context" + + pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/compute/v1" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type ImagesV1 struct { + *MockService + pb.UnimplementedImagesServer +} + +func (s *ImagesV1) GetFromFamily(ctx context.Context, req *pb.GetFromFamilyImageRequest) (*pb.Image, error) { + obj := &pb.Image{} + + // Details from gcloud compute images describe-from-family debian-11 --project debian-cloud --log-http + obj.Kind = PtrTo("compute#image") + obj.Name = PtrTo("debian-11-bullseye-v20231010") + obj.Description = PtrTo("Debian, Debian GNU/Linux, 11 (bullseye), amd64 built on 20231010") + obj.SelfLink = PtrTo("https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010") + obj.Family = PtrTo("debian-11") + obj.Status = PtrTo("UP") + + return obj, nil +} + +func (s *ImagesV1) Get(ctx context.Context, req *pb.GetImageRequest) (*pb.Image, error) { + // { + // "error": { + // "code": 404, + // "message": "The resource 'projects/debian-cloud/global/images/debian-11' was not found", + // "errors": [ + // { + // "message": "The resource 'projects/debian-cloud/global/images/debian-11' was not found", + // "domain": "global", + // "reason": "notFound" + // } + // ] + // } + // } + + return nil, status.Errorf(codes.NotFound, "image not found") +} diff --git a/mockgcp/mockcompute/instancesv1.go b/mockgcp/mockcompute/instancesv1.go new file mode 100644 index 0000000000..32df354271 --- /dev/null +++ b/mockgcp/mockcompute/instancesv1.go @@ -0,0 +1,356 @@ +// Copyright 2022 Google LLC +// +// 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. + +package mockcompute + +import ( + "context" + "fmt" + "strings" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" + apierrors "k8s.io/apimachinery/pkg/api/errors" + + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" + pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/compute/v1" +) + +type InstancesV1 struct { + *MockService + pb.UnimplementedInstancesServer +} + +func (s *InstancesV1) Get(ctx context.Context, req *pb.GetInstanceRequest) (*pb.Instance, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + "/instances/" + req.GetInstance() + name, err := s.parseZonalInstanceName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + + obj := &pb.Instance{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "instance %q not found", name) + } else { + return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + } + } + + return obj, nil +} + +func (s *InstancesV1) Insert(ctx context.Context, req *pb.InsertInstanceRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + "/instances/" + req.GetInstanceResource().GetName() + name, err := s.parseZonalInstanceName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + + id := s.generateID() + + obj := proto.Clone(req.GetInstanceResource()).(*pb.Instance) + obj.SelfLink = PtrTo("https://compute.googleapis.com/compute/v1/" + name.String()) + obj.CreationTimestamp = PtrTo(s.nowString()) + obj.Id = &id + obj.Kind = PtrTo("compute#instance") + obj.Zone = PtrTo(fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/zones/%s", name.Project.ID, name.Zone)) + obj.Status = PtrTo("RUNNING") + // if obj.MachineType == nil { + // machineType := "pd-standard" + // obj.MachineType = PtrTo(fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/zones/%s/machineTypes/%s", name.Project.ID, name.Zone, machineType)) + // } + + if err := s.storage.Create(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error creating instance: %v", err) + } + + return s.newLRO(ctx, name.Project.ID) +} + +// Updates a Instance resource in the specified project using the data included in the request. +func (s *InstancesV1) Update(ctx context.Context, req *pb.UpdateInstanceRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + "/instances/" + req.GetInstance() + name, err := s.parseZonalInstanceName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + obj := &pb.Instance{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) + } + return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + } + + // TODO: Implement helper to implement the full rules here + proto.Merge(obj, req.GetInstanceResource()) + + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + } + + return s.newLRO(ctx, name.Project.ID) +} + +func (s *InstancesV1) AttachDisk(ctx context.Context, req *pb.AttachDiskInstanceRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + "/instances/" + req.GetInstance() + name, err := s.parseZonalInstanceName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + obj := &pb.Instance{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) + } + return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + } + + attachedDisk := proto.Clone(req.GetAttachedDiskResource()).(*pb.AttachedDisk) + attachedDisk.Kind = PtrTo("compute#attachedDisk") + attachedDisk.Index = PtrTo(int32(len(obj.Disks))) + + obj.Disks = append(obj.Disks, attachedDisk) + + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + } + + return s.newLRO(ctx, name.Project.ID) +} + +func (s *InstancesV1) DetachDisk(ctx context.Context, req *pb.DetachDiskInstanceRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + "/instances/" + req.GetInstance() + name, err := s.parseZonalInstanceName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + obj := &pb.Instance{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) + } + return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + } + + var keepDisks []*pb.AttachedDisk + for _, disk := range obj.Disks { + if disk.GetDeviceName() != req.GetDeviceName() { + keepDisks = append(keepDisks, disk) + } + } + obj.Disks = keepDisks + + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + } + + return s.newLRO(ctx, name.Project.ID) +} + +func (s *InstancesV1) Stop(ctx context.Context, req *pb.StopInstanceRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + "/instances/" + req.GetInstance() + name, err := s.parseZonalInstanceName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + obj := &pb.Instance{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) + } + return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + } + + obj.Status = PtrTo("TERMINATED") + + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + } + + return s.newLRO(ctx, name.Project.ID) +} + +func (s *InstancesV1) Start(ctx context.Context, req *pb.StartInstanceRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + "/instances/" + req.GetInstance() + name, err := s.parseZonalInstanceName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + obj := &pb.Instance{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) + } + return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + } + + obj.Status = PtrTo("RUNNING") + + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + } + + return s.newLRO(ctx, name.Project.ID) +} + +func (s *InstancesV1) SetServiceAccount(ctx context.Context, req *pb.SetServiceAccountInstanceRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + "/instances/" + req.GetInstance() + name, err := s.parseZonalInstanceName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + obj := &pb.Instance{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) + } + return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + } + + obj.ServiceAccounts = []*pb.ServiceAccount{ + { + Email: req.GetInstancesSetServiceAccountRequestResource().Email, + Scopes: req.GetInstancesSetServiceAccountRequestResource().Scopes, + }, + } + + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + } + + return s.newLRO(ctx, name.Project.ID) +} + +func (s *InstancesV1) SetMachineType(ctx context.Context, req *pb.SetMachineTypeInstanceRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + "/instances/" + req.GetInstance() + name, err := s.parseZonalInstanceName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + obj := &pb.Instance{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) + } + return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + } + + obj.MachineType = req.GetInstancesSetMachineTypeRequestResource().MachineType + + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + } + + return s.newLRO(ctx, name.Project.ID) +} + +func (s *InstancesV1) Delete(ctx context.Context, req *pb.DeleteInstanceRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + "/instances/" + req.GetInstance() + name, err := s.parseZonalInstanceName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + + deleted := &pb.Instance{} + if err := s.storage.Delete(ctx, fqn, deleted); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "instance %q not found", name) + } else { + return nil, status.Errorf(codes.Internal, "error deleting instance: %v", err) + } + } + + return s.newLRO(ctx, name.Project.ID) +} + +func (s *InstancesV1) SetLabels(ctx context.Context, req *pb.SetLabelsInstanceRequest) (*pb.Operation, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + "/instances/" + req.GetInstance() + name, err := s.parseZonalInstanceName(reqName) + if err != nil { + return nil, err + } + + fqn := name.String() + obj := &pb.Instance{} + if err := s.storage.Get(ctx, fqn, obj); err != nil { + if apierrors.IsNotFound(err) { + return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) + } + return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + } + + obj.Labels = req.GetInstancesSetLabelsRequestResource().GetLabels() + + if err := s.storage.Update(ctx, fqn, obj); err != nil { + return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + } + + return s.newLRO(ctx, name.Project.ID) +} + +type zonalInstanceName struct { + Project *projects.ProjectData + Zone string + Name string +} + +func (n *zonalInstanceName) String() string { + return "projects/" + n.Project.ID + "/zones/" + n.Zone + "/instances/" + n.Name +} + +// parseZonalInstanceName parses a string into a zonalInstanceName. +// The expected form is `projects/*/zones/*/instance/*`. +func (s *MockService) parseZonalInstanceName(name string) (*zonalInstanceName, error) { + tokens := strings.Split(name, "/") + + if len(tokens) == 6 && tokens[0] == "projects" && tokens[2] == "zones" && tokens[4] == "instances" { + project, err := s.projects.GetProjectByID(tokens[1]) + if err != nil { + return nil, err + } + + name := &zonalInstanceName{ + Project: project, + Zone: tokens[3], + Name: tokens[5], + } + + return name, nil + } else { + return nil, status.Errorf(codes.InvalidArgument, "name %q is not valid", name) + } +} diff --git a/mockgcp/mockcompute/regionaladdress.go b/mockgcp/mockcompute/regionaladdress.go index 8f98dc10b5..0f8f2e4059 100644 --- a/mockgcp/mockcompute/regionaladdress.go +++ b/mockgcp/mockcompute/regionaladdress.go @@ -64,6 +64,7 @@ func (s *RegionalAddressesV1) Insert(ctx context.Context, req *pb.InsertAddressR obj.CreationTimestamp = PtrTo(s.nowString()) obj.Id = &id obj.Kind = PtrTo("compute#address") + obj.Address = PtrTo("8.8.8.8") if err := s.storage.Create(ctx, fqn, obj); err != nil { return nil, status.Errorf(codes.Internal, "error creating address: %v", err) diff --git a/mockgcp/mockcompute/service.go b/mockgcp/mockcompute/service.go index 778c52a1a7..948a819e94 100644 --- a/mockgcp/mockcompute/service.go +++ b/mockgcp/mockcompute/service.go @@ -68,6 +68,12 @@ func (s *MockService) Register(grpcServer *grpc.Server) { pb.RegisterAddressesServer(grpcServer, &RegionalAddressesV1{MockService: s}) pb.RegisterGlobalAddressesServer(grpcServer, &GlobalAddressesV1{MockService: s}) pb.RegisterSslCertificatesServer(grpcServer, &GlobalSSLCertificatesV1{MockService: s}) + + pb.RegisterImagesServer(grpcServer, &ImagesV1{MockService: s}) + + pb.RegisterInstancesServer(grpcServer, &InstancesV1{MockService: s}) + + pb.RegisterZonesServer(grpcServer, &ZonesV1{MockService: s}) } func (s *MockService) NewHTTPMux(ctx context.Context, conn *grpc.ClientConn) (http.Handler, error) { @@ -124,6 +130,16 @@ func (s *MockService) NewHTTPMux(ctx context.Context, conn *grpc.ClientConn) (ht return nil, err } + if err := pb.RegisterImagesHandler(ctx, mux.ServeMux, conn); err != nil { + return nil, err + } + if err := pb.RegisterInstancesHandler(ctx, mux.ServeMux, conn); err != nil { + return nil, err + } + if err := pb.RegisterZonesHandler(ctx, mux.ServeMux, conn); err != nil { + return nil, err + } + // Returns slightly non-standard errors mux.RewriteError = func(ctx context.Context, error *httpmux.ErrorResponse) { // Does not return status (at least for 404) diff --git a/mockgcp/mockcompute/zonesv1.go b/mockgcp/mockcompute/zonesv1.go new file mode 100644 index 0000000000..29da79a29f --- /dev/null +++ b/mockgcp/mockcompute/zonesv1.go @@ -0,0 +1,84 @@ +// Copyright 2022 Google LLC +// +// 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. + +package mockcompute + +import ( + "context" + "fmt" + "strings" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" + pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/compute/v1" +) + +type ZonesV1 struct { + *MockService + pb.UnimplementedZonesServer +} + +func (s *ZonesV1) Get(ctx context.Context, req *pb.GetZoneRequest) (*pb.Zone, error) { + reqName := "projects/" + req.GetProject() + "/zones/" + req.GetZone() + name, err := s.parseZoneName(reqName) + if err != nil { + return nil, err + } + + region := strings.Join(strings.Split(name.Zone, "-")[:2], "-") + region = fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/regions/%s", name.Project.ID, region) + + obj := &pb.Zone{} + + obj.Kind = PtrTo("compute#zone") + obj.Name = PtrTo(name.Zone) + obj.Status = PtrTo("UP") + obj.Region = ®ion + obj.SelfLink = PtrTo("https://www.googleapis.com/compute/v1" + name.String()) + + return obj, nil +} + +type zoneName struct { + Project *projects.ProjectData + Zone string +} + +func (n *zoneName) String() string { + return "projects/" + n.Project.ID + "/zones/" + n.Zone +} + +// parseZoneName parses a string into a zoneName. +// The expected form is `projects/*/zones/`. +func (s *MockService) parseZoneName(name string) (*zoneName, error) { + tokens := strings.Split(name, "/") + + if len(tokens) == 4 && tokens[0] == "projects" && tokens[2] == "zones" { + project, err := s.projects.GetProjectByID(tokens[1]) + if err != nil { + return nil, err + } + + name := &zoneName{ + Project: project, + Zone: tokens[3], + } + + return name, nil + } else { + return nil, status.Errorf(codes.InvalidArgument, "name %q is not valid", name) + } +} From f357aa6cda81b269ca5ad5482cb596b44adf1f7a Mon Sep 17 00:00:00 2001 From: Gemma Hou Date: Tue, 2 Jul 2024 23:19:46 +0000 Subject: [PATCH 2/4] projects->Projects --- mockgcp/mockcompute/instancesv1.go | 2 +- mockgcp/mockcompute/zonesv1.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mockgcp/mockcompute/instancesv1.go b/mockgcp/mockcompute/instancesv1.go index 32df354271..c2dff1460a 100644 --- a/mockgcp/mockcompute/instancesv1.go +++ b/mockgcp/mockcompute/instancesv1.go @@ -338,7 +338,7 @@ func (s *MockService) parseZonalInstanceName(name string) (*zonalInstanceName, e tokens := strings.Split(name, "/") if len(tokens) == 6 && tokens[0] == "projects" && tokens[2] == "zones" && tokens[4] == "instances" { - project, err := s.projects.GetProjectByID(tokens[1]) + project, err := s.Projects.GetProjectByID(tokens[1]) if err != nil { return nil, err } diff --git a/mockgcp/mockcompute/zonesv1.go b/mockgcp/mockcompute/zonesv1.go index 29da79a29f..c2feab4bc2 100644 --- a/mockgcp/mockcompute/zonesv1.go +++ b/mockgcp/mockcompute/zonesv1.go @@ -67,7 +67,7 @@ func (s *MockService) parseZoneName(name string) (*zoneName, error) { tokens := strings.Split(name, "/") if len(tokens) == 4 && tokens[0] == "projects" && tokens[2] == "zones" { - project, err := s.projects.GetProjectByID(tokens[1]) + project, err := s.Projects.GetProjectByID(tokens[1]) if err != nil { return nil, err } From d3736c63a8a9e0a248d34e253d52409c13e46421 Mon Sep 17 00:00:00 2001 From: Gemma Hou Date: Wed, 3 Jul 2024 17:55:37 +0000 Subject: [PATCH 3/4] collect logs --- mockgcp/mockcompute/instancesv1.go | 74 +- ...ct_computeinstancebasicexample.golden.yaml | 74 + .../computeinstancebasicexample/_http.log | 2401 +++++++++++++++++ ...mputeinstancewithencrypteddisk.golden.yaml | 54 + .../_http.log | 920 +++++++ tests/e2e/normalize.go | 3 +- tests/e2e/unified_test.go | 1 + 7 files changed, 3472 insertions(+), 55 deletions(-) create mode 100644 pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancebasicexample/_generated_object_computeinstancebasicexample.golden.yaml create mode 100644 pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancebasicexample/_http.log create mode 100644 pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancewithencrypteddisk/_generated_object_computeinstancewithencrypteddisk.golden.yaml create mode 100644 pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancewithencrypteddisk/_http.log diff --git a/mockgcp/mockcompute/instancesv1.go b/mockgcp/mockcompute/instancesv1.go index c2dff1460a..fa773232ea 100644 --- a/mockgcp/mockcompute/instancesv1.go +++ b/mockgcp/mockcompute/instancesv1.go @@ -19,13 +19,11 @@ import ( "fmt" "strings" + "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" + pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/compute/v1" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "google.golang.org/protobuf/proto" - apierrors "k8s.io/apimachinery/pkg/api/errors" - - "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/common/projects" - pb "github.com/GoogleCloudPlatform/k8s-config-connector/mockgcp/generated/mockgcp/cloud/compute/v1" ) type InstancesV1 struct { @@ -44,11 +42,7 @@ func (s *InstancesV1) Get(ctx context.Context, req *pb.GetInstanceRequest) (*pb. obj := &pb.Instance{} if err := s.storage.Get(ctx, fqn, obj); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "instance %q not found", name) - } else { - return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) - } + return nil, err } return obj, nil @@ -78,7 +72,7 @@ func (s *InstancesV1) Insert(ctx context.Context, req *pb.InsertInstanceRequest) // } if err := s.storage.Create(ctx, fqn, obj); err != nil { - return nil, status.Errorf(codes.Internal, "error creating instance: %v", err) + return nil, err } return s.newLRO(ctx, name.Project.ID) @@ -95,17 +89,14 @@ func (s *InstancesV1) Update(ctx context.Context, req *pb.UpdateInstanceRequest) fqn := name.String() obj := &pb.Instance{} if err := s.storage.Get(ctx, fqn, obj); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) - } - return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + return nil, err } // TODO: Implement helper to implement the full rules here proto.Merge(obj, req.GetInstanceResource()) if err := s.storage.Update(ctx, fqn, obj); err != nil { - return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + return nil, err } return s.newLRO(ctx, name.Project.ID) @@ -121,10 +112,7 @@ func (s *InstancesV1) AttachDisk(ctx context.Context, req *pb.AttachDiskInstance fqn := name.String() obj := &pb.Instance{} if err := s.storage.Get(ctx, fqn, obj); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) - } - return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + return nil, err } attachedDisk := proto.Clone(req.GetAttachedDiskResource()).(*pb.AttachedDisk) @@ -134,7 +122,7 @@ func (s *InstancesV1) AttachDisk(ctx context.Context, req *pb.AttachDiskInstance obj.Disks = append(obj.Disks, attachedDisk) if err := s.storage.Update(ctx, fqn, obj); err != nil { - return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + return nil, err } return s.newLRO(ctx, name.Project.ID) @@ -150,10 +138,7 @@ func (s *InstancesV1) DetachDisk(ctx context.Context, req *pb.DetachDiskInstance fqn := name.String() obj := &pb.Instance{} if err := s.storage.Get(ctx, fqn, obj); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) - } - return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + return nil, err } var keepDisks []*pb.AttachedDisk @@ -165,7 +150,7 @@ func (s *InstancesV1) DetachDisk(ctx context.Context, req *pb.DetachDiskInstance obj.Disks = keepDisks if err := s.storage.Update(ctx, fqn, obj); err != nil { - return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + return nil, err } return s.newLRO(ctx, name.Project.ID) @@ -181,16 +166,13 @@ func (s *InstancesV1) Stop(ctx context.Context, req *pb.StopInstanceRequest) (*p fqn := name.String() obj := &pb.Instance{} if err := s.storage.Get(ctx, fqn, obj); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) - } - return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + return nil, err } obj.Status = PtrTo("TERMINATED") if err := s.storage.Update(ctx, fqn, obj); err != nil { - return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + return nil, err } return s.newLRO(ctx, name.Project.ID) @@ -206,16 +188,13 @@ func (s *InstancesV1) Start(ctx context.Context, req *pb.StartInstanceRequest) ( fqn := name.String() obj := &pb.Instance{} if err := s.storage.Get(ctx, fqn, obj); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) - } - return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + return nil, err } obj.Status = PtrTo("RUNNING") if err := s.storage.Update(ctx, fqn, obj); err != nil { - return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + return nil, err } return s.newLRO(ctx, name.Project.ID) @@ -231,10 +210,7 @@ func (s *InstancesV1) SetServiceAccount(ctx context.Context, req *pb.SetServiceA fqn := name.String() obj := &pb.Instance{} if err := s.storage.Get(ctx, fqn, obj); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) - } - return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + return nil, err } obj.ServiceAccounts = []*pb.ServiceAccount{ @@ -261,16 +237,13 @@ func (s *InstancesV1) SetMachineType(ctx context.Context, req *pb.SetMachineType fqn := name.String() obj := &pb.Instance{} if err := s.storage.Get(ctx, fqn, obj); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) - } - return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + return nil, err } obj.MachineType = req.GetInstancesSetMachineTypeRequestResource().MachineType if err := s.storage.Update(ctx, fqn, obj); err != nil { - return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + return nil, err } return s.newLRO(ctx, name.Project.ID) @@ -287,11 +260,7 @@ func (s *InstancesV1) Delete(ctx context.Context, req *pb.DeleteInstanceRequest) deleted := &pb.Instance{} if err := s.storage.Delete(ctx, fqn, deleted); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "instance %q not found", name) - } else { - return nil, status.Errorf(codes.Internal, "error deleting instance: %v", err) - } + return nil, err } return s.newLRO(ctx, name.Project.ID) @@ -307,16 +276,13 @@ func (s *InstancesV1) SetLabels(ctx context.Context, req *pb.SetLabelsInstanceRe fqn := name.String() obj := &pb.Instance{} if err := s.storage.Get(ctx, fqn, obj); err != nil { - if apierrors.IsNotFound(err) { - return nil, status.Errorf(codes.NotFound, "instance %q not found", fqn) - } - return nil, status.Errorf(codes.Internal, "error reading instance: %v", err) + return nil, err } obj.Labels = req.GetInstancesSetLabelsRequestResource().GetLabels() if err := s.storage.Update(ctx, fqn, obj); err != nil { - return nil, status.Errorf(codes.Internal, "error updating instance: %v", err) + return nil, err } return s.newLRO(ctx, name.Project.ID) diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancebasicexample/_generated_object_computeinstancebasicexample.golden.yaml b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancebasicexample/_generated_object_computeinstancebasicexample.golden.yaml new file mode 100644 index 0000000000..08fa6a8a6e --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancebasicexample/_generated_object_computeinstancebasicexample.golden.yaml @@ -0,0 +1,74 @@ +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeInstance +metadata: + annotations: + cnrm.cloud.google.com/allow-stopping-for-update: "true" + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/observed-secret-versions: (removed) + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 4 + labels: + cnrm-test: "true" + label-one: value-two + name: computeinstance-${uniqueId} + namespace: ${uniqueId} +spec: + attachedDisk: + - mode: READ_WRITE + sourceDiskRef: + name: computedisk-1-${uniqueId} + bootDisk: + autoDelete: false + initializeParams: + labels: + cnrm-test: "true" + managed-by-cnrm: "true" + sourceImageRef: + external: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010 + type: pd-standard + mode: READ_WRITE + sourceDiskRef: + name: computedisk-${uniqueId} + description: an basic instance example + machineType: n1-standard-2 + metadata: + - key: foo + value: bar + - key: bar + value: baz + metadataStartupScript: echo hi > /test.txt + networkInterface: + - accessConfig: + - natIpRef: + name: computeaddress-2-${uniqueId} + networkIpRef: + kind: ComputeAddress + name: computeaddress-${uniqueId} + networkRef: + name: default + resourceID: computeinstance-${uniqueId} + scheduling: + automaticRestart: false + onHostMaintenance: TERMINATE + preemptible: true + serviceAccount: + scopes: + - compute-ro + serviceAccountRef: + name: gsa-${uniqueId} + zone: us-west1-a +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + currentStatus: RUNNING + instanceId: "1111111111111111" + observedGeneration: 4 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancebasicexample/_http.log b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancebasicexample/_http.log new file mode 100644 index 0000000000..80feafb233 --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancebasicexample/_http.log @@ -0,0 +1,2401 @@ +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "disk \"projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}\" not found", + "reason": "notFound" + } + ], + "message": "disk \"projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}\" not found" + } +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/debian-cloud/global/images/debian-11?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "image not found", + "reason": "notFound" + } + ], + "message": "image not found" + } +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/debian-cloud/global/images/family/debian-11?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "description": "Debian, Debian GNU/Linux, 11 (bullseye), amd64 built on 20231010", + "family": "debian-11", + "kind": "compute#image", + "name": "debian-11-bullseye-v20231010", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "status": "UP" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "sourceImage": "projects/debian-cloud/global/images/family/debian-11", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "projects/${projectId}/global/zones/us-west1-a" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "disk \"projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}\" not found", + "reason": "notFound" + } + ], + "message": "disk \"projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}\" not found" + } +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "description": "an attached disk for Compute Instance", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-1-${uniqueId}", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "projects/${projectId}/global/zones/us-west1-a" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "an attached disk for Compute Instance", + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-1-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${networkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +PATCH https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "networkFirewallPolicyEnforcementOrder": "AFTER_CLASSIC_FIREWALL" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "compute.networks.patch", + "progress": 0, + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${networkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +PATCH https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "networkFirewallPolicyEnforcementOrder": "AFTER_CLASSIC_FIREWALL" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "compute.networks.patch", + "progress": 0, + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${networkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +GET https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "Unknown service account", + "reason": "notFound" + } + ], + "message": "Unknown service account", + "status": "NOT_FOUND" + } +} + +--- + +POST https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "accountId": "gsa-${uniqueId}", + "serviceAccount": {} +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "etag": "abcdef0123A=", + "name": "projects/${projectId}/serviceAccounts/gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "oauth2ClientId": "888888888888888888888", + "projectId": "${projectId}", + "uniqueId": "111111111111111111111" +} + +--- + +GET https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "etag": "abcdef0123A=", + "name": "projects/${projectId}/serviceAccounts/gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "oauth2ClientId": "888888888888888888888", + "projectId": "${projectId}", + "uniqueId": "111111111111111111111" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "address \"projects/${projectId}/regions/us-west1/networks/computeaddress-${uniqueId}\" not found", + "reason": "notFound" + } + ], + "message": "address \"projects/${projectId}/regions/us-west1/networks/computeaddress-${uniqueId}\" not found" + } +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "addressType": "INTERNAL", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computeaddress-${uniqueId}", + "purpose": "GCE_ENDPOINT", + "region": "projects/${projectId}/global/regions/us-west1" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "address": "8.8.8.8", + "addressType": "INTERNAL", + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#address", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computeaddress-${uniqueId}", + "purpose": "GCE_ENDPOINT", + "region": "projects/${projectId}/global/regions/us-west1", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-west1/networks/computeaddress-${uniqueId}" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-${uniqueId}/setLabels?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "labelFingerprint": "", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + } +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "address": "8.8.8.8", + "addressType": "INTERNAL", + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#address", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computeaddress-${uniqueId}", + "purpose": "GCE_ENDPOINT", + "region": "projects/${projectId}/global/regions/us-west1", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-west1/networks/computeaddress-${uniqueId}" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-2-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "address \"projects/${projectId}/regions/us-west1/networks/computeaddress-2-${uniqueId}\" not found", + "reason": "notFound" + } + ], + "message": "address \"projects/${projectId}/regions/us-west1/networks/computeaddress-2-${uniqueId}\" not found" + } +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "addressType": "EXTERNAL", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computeaddress-2-${uniqueId}", + "region": "projects/${projectId}/global/regions/us-west1" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-2-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "address": "8.8.8.8", + "addressType": "EXTERNAL", + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#address", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computeaddress-2-${uniqueId}", + "region": "projects/${projectId}/global/regions/us-west1", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-west1/networks/computeaddress-2-${uniqueId}" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-2-${uniqueId}/setLabels?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "labelFingerprint": "", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + } +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-2-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "address": "8.8.8.8", + "addressType": "EXTERNAL", + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#address", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computeaddress-2-${uniqueId}", + "region": "projects/${projectId}/global/regions/us-west1", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-west1/networks/computeaddress-2-${uniqueId}" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "instance \"projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}\" not found", + "reason": "notFound" + } + ], + "message": "instance \"projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}\" not found" + } +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "kind": "compute#zone", + "name": "us-west1-a", + "region": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-west1", + "selfLink": "https://www.googleapis.com/compute/v1projects/${projectId}/zones/us-west1-a", + "status": "UP" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "canIpForward": false, + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + }, + { + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}" + } + ], + "labels": { + "cnrm-test": "true", + "label-one": "value-one", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-1", + "metadata": { + "items": [ + { + "key": "bar", + "value": "baz" + }, + { + "key": "foo", + "value": "bar" + }, + { + "key": "startup-script", + "value": "echo hi \u003e /test.txt" + } + ] + }, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "natIP": "8.8.8.8", + "type": "ONE_TO_ONE_NAT" + } + ], + "network": "projects/${projectId}/global/networks/${networkID}", + "networkIP": "8.8.8.8" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "nodeAffinities": [ + null + ], + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "serviceAccounts": [ + { + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + ], + "tags": {} +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + }, + { + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "label-one": "value-one", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-1", + "metadata": { + "items": [ + { + "key": "bar", + "value": "baz" + }, + { + "key": "foo", + "value": "bar" + }, + { + "key": "startup-script", + "value": "echo hi \u003e /test.txt" + } + ] + }, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "natIP": "8.8.8.8", + "type": "ONE_TO_ONE_NAT" + } + ], + "network": "projects/${projectId}/global/networks/${networkID}", + "networkIP": "8.8.8.8" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "serviceAccounts": [ + { + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + ], + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + }, + { + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "label-one": "value-one", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-1", + "metadata": { + "items": [ + { + "key": "bar", + "value": "baz" + }, + { + "key": "foo", + "value": "bar" + }, + { + "key": "startup-script", + "value": "echo hi \u003e /test.txt" + } + ] + }, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "natIP": "8.8.8.8", + "type": "ONE_TO_ONE_NAT" + } + ], + "network": "projects/${projectId}/global/networks/${networkID}", + "networkIP": "8.8.8.8" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "serviceAccounts": [ + { + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + ], + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + }, + { + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "label-one": "value-one", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-1", + "metadata": { + "items": [ + { + "key": "bar", + "value": "baz" + }, + { + "key": "foo", + "value": "bar" + }, + { + "key": "startup-script", + "value": "echo hi \u003e /test.txt" + } + ] + }, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "natIP": "8.8.8.8", + "type": "ONE_TO_ONE_NAT" + } + ], + "network": "projects/${projectId}/global/networks/${networkID}", + "networkIP": "8.8.8.8" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "serviceAccounts": [ + { + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + ], + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + }, + { + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "label-one": "value-one", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-1", + "metadata": { + "items": [ + { + "key": "bar", + "value": "baz" + }, + { + "key": "foo", + "value": "bar" + }, + { + "key": "startup-script", + "value": "echo hi \u003e /test.txt" + } + ] + }, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "natIP": "8.8.8.8", + "type": "ONE_TO_ONE_NAT" + } + ], + "network": "projects/${projectId}/global/networks/${networkID}", + "networkIP": "8.8.8.8" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "serviceAccounts": [ + { + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + ], + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}/setLabels?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "labels": { + "cnrm-test": "true", + "label-one": "value-two", + "managed-by-cnrm": "true" + } +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}/stop?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}/setMachineType?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-2" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}/setServiceAccount?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "scopes": [ + "https://www.googleapis.com/auth/compute.readonly" + ] +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + }, + { + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "label-one": "value-two", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-2", + "metadata": { + "items": [ + { + "key": "bar", + "value": "baz" + }, + { + "key": "foo", + "value": "bar" + }, + { + "key": "startup-script", + "value": "echo hi \u003e /test.txt" + } + ] + }, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "natIP": "8.8.8.8", + "type": "ONE_TO_ONE_NAT" + } + ], + "network": "projects/${projectId}/global/networks/${networkID}", + "networkIP": "8.8.8.8" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "serviceAccounts": [ + { + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "scopes": [ + "https://www.googleapis.com/auth/compute.readonly" + ] + } + ], + "status": "TERMINATED", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}/start?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + }, + { + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "label-one": "value-two", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-2", + "metadata": { + "items": [ + { + "key": "bar", + "value": "baz" + }, + { + "key": "foo", + "value": "bar" + }, + { + "key": "startup-script", + "value": "echo hi \u003e /test.txt" + } + ] + }, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "natIP": "8.8.8.8", + "type": "ONE_TO_ONE_NAT" + } + ], + "network": "projects/${projectId}/global/networks/${networkID}", + "networkIP": "8.8.8.8" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "serviceAccounts": [ + { + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "scopes": [ + "https://www.googleapis.com/auth/compute.readonly" + ] + } + ], + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + }, + { + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "label-one": "value-two", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-2", + "metadata": { + "items": [ + { + "key": "bar", + "value": "baz" + }, + { + "key": "foo", + "value": "bar" + }, + { + "key": "startup-script", + "value": "echo hi \u003e /test.txt" + } + ] + }, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "natIP": "8.8.8.8", + "type": "ONE_TO_ONE_NAT" + } + ], + "network": "projects/${projectId}/global/networks/${networkID}", + "networkIP": "8.8.8.8" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "serviceAccounts": [ + { + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "scopes": [ + "https://www.googleapis.com/auth/compute.readonly" + ] + } + ], + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + }, + { + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "label-one": "value-two", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-2", + "metadata": { + "items": [ + { + "key": "bar", + "value": "baz" + }, + { + "key": "foo", + "value": "bar" + }, + { + "key": "startup-script", + "value": "echo hi \u003e /test.txt" + } + ] + }, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "natIP": "8.8.8.8", + "type": "ONE_TO_ONE_NAT" + } + ], + "network": "projects/${projectId}/global/networks/${networkID}", + "networkIP": "8.8.8.8" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "serviceAccounts": [ + { + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "scopes": [ + "https://www.googleapis.com/auth/compute.readonly" + ] + } + ], + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +DELETE https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-2-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "address": "8.8.8.8", + "addressType": "EXTERNAL", + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#address", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computeaddress-2-${uniqueId}", + "region": "projects/${projectId}/global/regions/us-west1", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-west1/networks/computeaddress-2-${uniqueId}" +} + +--- + +DELETE https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-2-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "address": "8.8.8.8", + "addressType": "INTERNAL", + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#address", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computeaddress-${uniqueId}", + "purpose": "GCE_ENDPOINT", + "region": "projects/${projectId}/global/regions/us-west1", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-west1/networks/computeaddress-${uniqueId}" +} + +--- + +DELETE https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-west1/addresses/computeaddress-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "email": "gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "etag": "abcdef0123A=", + "name": "projects/${projectId}/serviceAccounts/gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com", + "oauth2ClientId": "888888888888888888888", + "projectId": "${projectId}", + "uniqueId": "111111111111111111111" +} + +--- + +DELETE https://iam.googleapis.com/v1/projects/${projectId}/serviceAccounts/gsa-${uniqueId}@${projectId}.iam.gserviceaccount.com?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "an attached disk for Compute Instance", + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-1-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +DELETE https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-1-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +DELETE https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} \ No newline at end of file diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancewithencrypteddisk/_generated_object_computeinstancewithencrypteddisk.golden.yaml b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancewithencrypteddisk/_generated_object_computeinstancewithencrypteddisk.golden.yaml new file mode 100644 index 0000000000..4c175a6fac --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancewithencrypteddisk/_generated_object_computeinstancewithencrypteddisk.golden.yaml @@ -0,0 +1,54 @@ +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeInstance +metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/observed-secret-versions: (removed) + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 2 + labels: + cnrm-test: "true" + env: prod + name: computeinstance-${uniqueId} + namespace: ${uniqueId} +spec: + bootDisk: + autoDelete: false + diskEncryptionKeyRaw: + value: SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0= + initializeParams: + labels: + cnrm-test: "true" + managed-by-cnrm: "true" + sourceImageRef: + external: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010 + type: pd-standard + mode: READ_WRITE + sourceDiskRef: + name: computedisk-${uniqueId} + description: an basic instance example + machineType: n1-standard-1 + networkInterface: + - networkRef: + name: default + resourceID: computeinstance-${uniqueId} + scheduling: + automaticRestart: false + onHostMaintenance: TERMINATE + preemptible: true + zone: us-west1-a +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + currentStatus: RUNNING + instanceId: "1111111111111111" + observedGeneration: 2 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancewithencrypteddisk/_http.log b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancewithencrypteddisk/_http.log new file mode 100644 index 0000000000..8f92747deb --- /dev/null +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeinstance/computeinstancewithencrypteddisk/_http.log @@ -0,0 +1,920 @@ +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "disk \"projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}\" not found", + "reason": "notFound" + } + ], + "message": "disk \"projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}\" not found" + } +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/debian-cloud/global/images/debian-11?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "image not found", + "reason": "notFound" + } + ], + "message": "image not found" + } +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/debian-cloud/global/images/family/debian-11?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "description": "Debian, Debian GNU/Linux, 11 (bullseye), amd64 built on 20231010", + "family": "debian-11", + "kind": "compute#image", + "name": "debian-11-bullseye-v20231010", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "status": "UP" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "sourceImage": "projects/debian-cloud/global/images/family/debian-11", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "projects/${projectId}/global/zones/us-west1-a" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${networkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +PATCH https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "networkFirewallPolicyEnforcementOrder": "AFTER_CLASSIC_FIREWALL" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "compute.networks.patch", + "progress": 0, + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${networkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +PATCH https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "networkFirewallPolicyEnforcementOrder": "AFTER_CLASSIC_FIREWALL" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "compute.networks.patch", + "progress": 0, + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${networkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "instance \"projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}\" not found", + "reason": "notFound" + } + ], + "message": "instance \"projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}\" not found" + } +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "kind": "compute#zone", + "name": "us-west1-a", + "region": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-west1", + "selfLink": "https://www.googleapis.com/compute/v1projects/${projectId}/zones/us-west1-a", + "status": "UP" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "canIpForward": false, + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + } + ], + "labels": { + "cnrm-test": "true", + "env": "test", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-1", + "metadata": {}, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "network": "projects/${projectId}/global/networks/${networkID}" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "nodeAffinities": [ + null + ], + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "tags": {} +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "env": "test", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-1", + "metadata": {}, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "network": "projects/${projectId}/global/networks/${networkID}" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "env": "test", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-1", + "metadata": {}, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "network": "projects/${projectId}/global/networks/${networkID}" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "env": "test", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-1", + "metadata": {}, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "network": "projects/${projectId}/global/networks/${networkID}" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": false, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "description": "an basic instance example", + "disks": [ + { + "boot": true, + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "mode": "READ_WRITE", + "source": "projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "env": "test", + "managed-by-cnrm": "true" + }, + "machineType": "projects/${projectId}/zones/us-west1-a/machineTypes/n1-standard-1", + "metadata": {}, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "network": "projects/${projectId}/global/networks/${networkID}" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": false, + "instanceTerminationAction": "", + "onHostMaintenance": "TERMINATE", + "preemptible": true, + "provisioningModel": "" + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}", + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +DELETE https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "diskEncryptionKey": { + "rawKey": "SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=" + }, + "id": "000000000000000000000", + "kind": "compute#disk", + "labels": { + "cnrm-test": "true", + "managed-by-cnrm": "true" + }, + "name": "computedisk-${uniqueId}", + "physicalBlockSizeBytes": "4096", + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}", + "sourceImage": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "sourceImageId": "2443108620951880213", + "status": "READY", + "type": "projects/${projectId}/zones/us-west1-a/diskTypes/pd-standard", + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-west1-a" +} + +--- + +DELETE https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-west1-a/disks/computedisk-${uniqueId}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} \ No newline at end of file diff --git a/tests/e2e/normalize.go b/tests/e2e/normalize.go index 4389a0fefc..0efe0d0429 100644 --- a/tests/e2e/normalize.go +++ b/tests/e2e/normalize.go @@ -103,8 +103,9 @@ func normalizeKRMObject(u *unstructured.Unstructured, project testgcp.GCPProject visitor.replacePaths[".spec.softDeletePolicy.effectiveTime"] = "1970-01-01T00:00:00Z" visitor.replacePaths[".status.observedState.softDeletePolicy.effectiveTime"] = "1970-01-01T00:00:00Z" - // Specific to Compute SSL Certs + // Specific to Compute visitor.replacePaths[".status.observedState.certificateID"] = "1.719337333063698e+18" + visitor.replacePaths[".status.instanceId"] = "1111111111111111" // Specific to MonitoringDashboard visitor.stringTransforms = append(visitor.stringTransforms, func(path string, s string) string { diff --git a/tests/e2e/unified_test.go b/tests/e2e/unified_test.go index 802714c0dd..176571efd9 100644 --- a/tests/e2e/unified_test.go +++ b/tests/e2e/unified_test.go @@ -548,6 +548,7 @@ func runScenario(ctx context.Context, t *testing.T, testPause bool, fixture reso // For compute operations addReplacement("insertTime", "2024-04-01T12:34:56.123456Z") addReplacement("user", "user@example.com") + addReplacement("natIP", "192.0.0.10") // Specific to IAM/policy addReplacement("policy.etag", "abcdef0123A=") From b2f98624027492f32829fe9b827b6ef52310d7cc Mon Sep 17 00:00:00 2001 From: Gemma Hou Date: Wed, 3 Jul 2024 22:18:07 +0000 Subject: [PATCH 4/4] Fix test failures --- ..._object_regionalcomputeaddress.golden.yaml | 17 +- .../regionalcomputeaddress/_http.log | 2 + ...bject_networkipcomputeinstance.golden.yaml | 50 ++ .../networkipcomputeinstance/_http.log | 630 ++++++++++++++++++ .../networkipcomputeinstance/create.yaml | 2 +- .../networkipcomputeinstance/update.yaml | 2 +- 6 files changed, 687 insertions(+), 16 deletions(-) create mode 100644 pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/_generated_object_networkipcomputeinstance.golden.yaml create mode 100644 pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/_http.log diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeaddress/regionalcomputeaddress/_generated_object_regionalcomputeaddress.golden.yaml b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeaddress/regionalcomputeaddress/_generated_object_regionalcomputeaddress.golden.yaml index 44285b58b9..abaee13d83 100644 --- a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeaddress/regionalcomputeaddress/_generated_object_regionalcomputeaddress.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeaddress/regionalcomputeaddress/_generated_object_regionalcomputeaddress.golden.yaml @@ -1,17 +1,3 @@ -# Copyright 2024 Google LLC -# -# 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. - apiVersion: compute.cnrm.cloud.google.com/v1beta1 kind: ComputeAddress metadata: @@ -28,6 +14,7 @@ metadata: name: computeaddress-${uniqueId} namespace: ${uniqueId} spec: + address: 8.8.8.8 addressType: INTERNAL description: a test address location: us-central1 @@ -43,4 +30,6 @@ status: type: Ready creationTimestamp: "1970-01-01T00:00:00Z" observedGeneration: 2 + observedState: + address: 8.8.8.8 selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/networks/computeaddress-${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeaddress/regionalcomputeaddress/_http.log b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeaddress/regionalcomputeaddress/_http.log index f73d82b50b..4f310d8907 100644 --- a/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeaddress/regionalcomputeaddress/_http.log +++ b/pkg/test/resourcefixture/testdata/basic/compute/v1beta1/computeaddress/regionalcomputeaddress/_http.log @@ -350,6 +350,7 @@ X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 { + "address": "8.8.8.8", "addressType": "INTERNAL", "creationTimestamp": "2024-04-01T12:34:56.123456Z", "description": "a test address", @@ -419,6 +420,7 @@ X-Frame-Options: SAMEORIGIN X-Xss-Protection: 0 { + "address": "8.8.8.8", "addressType": "INTERNAL", "creationTimestamp": "2024-04-01T12:34:56.123456Z", "description": "a test address", diff --git a/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/_generated_object_networkipcomputeinstance.golden.yaml b/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/_generated_object_networkipcomputeinstance.golden.yaml new file mode 100644 index 0000000000..37eeec0b59 --- /dev/null +++ b/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/_generated_object_networkipcomputeinstance.golden.yaml @@ -0,0 +1,50 @@ +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeInstance +metadata: + annotations: + cnrm.cloud.google.com/allow-stopping-for-update: "true" + cnrm.cloud.google.com/management-conflict-prevention-policy: none + cnrm.cloud.google.com/observed-secret-versions: (removed) + cnrm.cloud.google.com/project-id: ${projectId} + cnrm.cloud.google.com/state-into-spec: merge + finalizers: + - cnrm.cloud.google.com/finalizer + - cnrm.cloud.google.com/deletion-defender + generation: 4 + labels: + cnrm-test: "true" + created-from: image-2 + network-type: subnetwork-2 + name: computeinstance-${uniqueId} + namespace: ${uniqueId} +spec: + bootDisk: + autoDelete: true + initializeParams: + sourceImageRef: + external: debian-cloud/debian-11 + mode: READ_WRITE + canIpForward: true + machineType: n1-standard-1 + networkInterface: + - accessConfig: + - networkTier: PREMIUM + networkIp: 10.128.0.9 + subnetworkProject: ${projectId} + subnetworkRef: + name: default + resourceID: computeinstance-${uniqueId} + scheduling: + automaticRestart: true + zone: us-central1-a +status: + conditions: + - lastTransitionTime: "1970-01-01T00:00:00Z" + message: The resource is up to date + reason: UpToDate + status: "True" + type: Ready + currentStatus: RUNNING + instanceId: "1111111111111111" + observedGeneration: 4 + selfLink: https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-central1-a/instances/computeinstance-${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/_http.log b/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/_http.log new file mode 100644 index 0000000000..95d4904562 --- /dev/null +++ b/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/_http.log @@ -0,0 +1,630 @@ +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${subnetworkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${subnetworkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${subnetworkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +PATCH https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${subnetworkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "networkFirewallPolicyEnforcementOrder": "AFTER_CLASSIC_FIREWALL" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "compute.networks.patch", + "progress": 0, + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${subnetworkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${subnetworkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${subnetworkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${subnetworkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +PATCH https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${subnetworkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "networkFirewallPolicyEnforcementOrder": "AFTER_CLASSIC_FIREWALL" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "compute.networks.patch", + "progress": 0, + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${networkID}", + "targetLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${subnetworkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/global/networks/${subnetworkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "description": "Default network for the project", + "id": "000000000000000000000", + "kind": "compute#network", + "name": "${subnetworkID}", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${subnetworkID}", + "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${networkID}" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "The resource 'projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}' was not found", + "reason": "notFound" + } + ], + "message": "The resource 'projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}' was not found" + } +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1/subnetworks?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "ipCidrRange": "10.128.0.0/20", + "logConfig": { + "enable": false + }, + "name": "${subnetworkID}", + "network": "projects/${projectId}/global/networks/${subnetworkID}", + "region": "projects/${projectId}/global/regions/us-central1" +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "operationType": "insert", + "progress": 0, + "region": "https://www.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "RUNNING", + "targetId": "${subnetworkNumber}", + "targetLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}", + "user": "user@example.com" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}?alt=json +Content-Type: application/json +User-Agent: Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "enableFlowLogs": false, + "fingerprint": "abcdef0123A=", + "gatewayAddress": "10.2.0.1", + "id": "000000000000000000000", + "ipCidrRange": "10.128.0.0/20", + "kind": "compute#subnetwork", + "logConfig": { + "enable": false + }, + "name": "${subnetworkID}", + "network": "https://www.googleapis.com/compute/beta/projects/${projectId}/global/networks/${subnetworkID}", + "privateIpGoogleAccess": false, + "privateIpv6GoogleAccess": "DISABLE_GOOGLE_ACCESS", + "purpose": "PRIVATE", + "region": "https://www.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/beta/projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}", + "stackType": "IPV4_ONLY" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-central1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "instance \"projects/${projectId}/zones/us-central1-a/instances/computeinstance-${uniqueId}\" not found", + "reason": "notFound" + } + ], + "message": "instance \"projects/${projectId}/zones/us-central1-a/instances/computeinstance-${uniqueId}\" not found" + } +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-central1-a?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "kind": "compute#zone", + "name": "us-central1-a", + "region": "https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1", + "selfLink": "https://www.googleapis.com/compute/v1projects/${projectId}/zones/us-central1-a", + "status": "UP" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/debian-cloud/global/images/debian-11?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +404 Not Found +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "error": { + "code": 404, + "errors": [ + { + "domain": "global", + "message": "image not found", + "reason": "notFound" + } + ], + "message": "image not found" + } +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/debian-cloud/global/images/family/debian-11?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "description": "Debian, Debian GNU/Linux, 11 (bullseye), amd64 built on 20231010", + "family": "debian-11", + "kind": "compute#image", + "name": "debian-11-bullseye-v20231010", + "selfLink": "https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-11-bullseye-v20231010", + "status": "UP" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-central1-a/instances?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "canIpForward": true, + "deletionProtection": false, + "disks": [ + { + "autoDelete": true, + "boot": true, + "initializeParams": { + "sourceImage": "projects/debian-cloud/global/images/family/debian-11" + }, + "mode": "READ_WRITE" + } + ], + "labels": { + "cnrm-test": "true", + "created-from": "image", + "managed-by-cnrm": "true", + "network-type": "subnetwork" + }, + "machineType": "projects/${projectId}/zones/us-central1-a/machineTypes/n1-standard-1", + "metadata": {}, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "networkTier": "PREMIUM", + "type": "ONE_TO_ONE_NAT" + } + ], + "networkIP": "10.128.0.9", + "subnetwork": "projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": true + }, + "tags": {} +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-central1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": true, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "disks": [ + { + "autoDelete": true, + "boot": true, + "initializeParams": { + "sourceImage": "projects/debian-cloud/global/images/family/debian-11" + }, + "mode": "READ_WRITE" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "created-from": "image", + "managed-by-cnrm": "true", + "network-type": "subnetwork" + }, + "machineType": "projects/${projectId}/zones/us-central1-a/machineTypes/n1-standard-1", + "metadata": {}, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "networkTier": "PREMIUM", + "type": "ONE_TO_ONE_NAT" + } + ], + "networkIP": "10.128.0.9", + "subnetwork": "projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": true + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-central1-a/instances/computeinstance-${uniqueId}", + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-central1-a" +} + +--- + +POST https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-central1-a/instances/computeinstance-${uniqueId}/setLabels?alt=json&prettyPrint=false +Content-Type: application/json +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +{ + "labels": { + "cnrm-test": "true", + "created-from": "image-2", + "managed-by-cnrm": "true", + "network-type": "subnetwork-2" + } +} + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} + +--- + +GET https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-central1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "canIpForward": true, + "creationTimestamp": "2024-04-01T12:34:56.123456Z", + "deletionProtection": false, + "disks": [ + { + "autoDelete": true, + "boot": true, + "initializeParams": { + "sourceImage": "projects/debian-cloud/global/images/family/debian-11" + }, + "mode": "READ_WRITE" + } + ], + "id": "000000000000000000000", + "kind": "compute#instance", + "labels": { + "cnrm-test": "true", + "created-from": "image-2", + "managed-by-cnrm": "true", + "network-type": "subnetwork-2" + }, + "machineType": "projects/${projectId}/zones/us-central1-a/machineTypes/n1-standard-1", + "metadata": {}, + "name": "computeinstance-${uniqueId}", + "networkInterfaces": [ + { + "accessConfigs": [ + { + "networkTier": "PREMIUM", + "type": "ONE_TO_ONE_NAT" + } + ], + "networkIP": "10.128.0.9", + "subnetwork": "projects/${projectId}/regions/us-central1/subnetworks/${subnetworkID}" + } + ], + "params": {}, + "scheduling": { + "automaticRestart": true + }, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/zones/us-central1-a/instances/computeinstance-${uniqueId}", + "status": "RUNNING", + "tags": {}, + "zone": "https://www.googleapis.com/compute/v1/projects/${projectId}/zones/us-central1-a" +} + +--- + +DELETE https://compute.googleapis.com/compute/beta/projects/${projectId}/zones/us-central1-a/instances/computeinstance-${uniqueId}?alt=json&prettyPrint=false +User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager + +200 OK +Cache-Control: private +Content-Type: application/json; charset=UTF-8 +Server: ESF +Vary: Origin +Vary: X-Origin +Vary: Referer +X-Content-Type-Options: nosniff +X-Frame-Options: SAMEORIGIN +X-Xss-Protection: 0 + +{ + "id": "000000000000000000000", + "insertTime": "2024-04-01T12:34:56.123456Z", + "kind": "compute#operation", + "name": "${operationID}", + "progress": 0, + "selfLink": "https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}", + "startTime": "2024-04-01T12:34:56.123456Z", + "status": "DONE" +} \ No newline at end of file diff --git a/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/create.yaml b/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/create.yaml index ae93103720..55b90e5860 100644 --- a/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/create.yaml +++ b/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/create.yaml @@ -32,6 +32,6 @@ spec: - subnetworkRef: name: default networkIp: "10.128.0.9" - accessConfigs: + accessConfig: - networkTier: "PREMIUM" canIpForward: true diff --git a/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/update.yaml b/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/update.yaml index 4231433f45..36be941a08 100644 --- a/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/update.yaml +++ b/pkg/test/resourcefixture/testdata/resourceoverrides/computeinstance/networkipcomputeinstance/update.yaml @@ -32,6 +32,6 @@ spec: - subnetworkRef: name: default networkIp: "10.128.0.9" - accessConfigs: + accessConfig: - networkTier: "PREMIUM" canIpForward: true