Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Eventarc update #8895

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changelog/4611.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```release-note:enhancement
eventarc: added `transport.pubsub.topic` to `google_eventarc_trigger` (beta only)
```
```release-note:new-resource
google_eventarc_trigger (GA only)
```
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/hashicorp/terraform-provider-google

require (
cloud.google.com/go/bigtable v1.5.0
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20210405181318-9364c5bf716b // indirect
github.com/GoogleCloudPlatform/declarative-resource-client-library v0.0.0-20210405181318-9364c5bf716b
github.com/apparentlymart/go-cidr v1.1.0
github.com/aws/aws-sdk-go v1.31.9 // indirect
github.com/client9/misspell v0.3.4
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bitbucket.org/creachadair/stringset v0.0.8 h1:gQqe4vs8XWgMyijfyKE6K8o4TcyGGrRXe0JvHgx5H+M=
bitbucket.org/creachadair/stringset v0.0.8/go.mod h1:AgthVMyMxC/6FK1KBJ2ALdqkZObGN8hOetgpwXyMn34=
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
Expand Down Expand Up @@ -76,6 +77,7 @@ github.com/aws/aws-sdk-go v1.31.9/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas=
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4=
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s=
Expand Down Expand Up @@ -157,6 +159,7 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I=
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
Expand Down Expand Up @@ -394,6 +397,7 @@ github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE=
github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/mozilla/tls-observatory v0.0.0-20180409132520-8791a200eb40/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk=
github.com/nbutton23/zxcvbn-go v0.0.0-20160627004424-a22cb81b2ecd/go.mod h1:o96djdrsSGy3AWPyBgZMAGfxZNfgntdJG+11KU4QvbU=
Expand Down
7 changes: 7 additions & 0 deletions google/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"google.golang.org/api/option"

dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
eventarcDcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc"
"golang.org/x/oauth2"
googleoauth "golang.org/x/oauth2/google"
appengine "google.golang.org/api/appengine/v1"
Expand Down Expand Up @@ -160,6 +162,8 @@ type Config struct {
requestBatcherIam *RequestBatcher

// start DCL clients
dclConfig *dcl.Config
clientEventarcDCL *eventarcDcl.Client
}

// Generated product base paths
Expand Down Expand Up @@ -278,6 +282,9 @@ func (c *Config) LoadAndValidate(ctx context.Context) error {
c.PollInterval = 10 * time.Second

// Start DCL client instantiation
// TODO(slevenick): handle user agents
c.dclConfig = dcl.NewConfig(dcl.WithHTTPClient(client), dcl.WithUserAgent(c.userAgent), dcl.WithLogger(dclLogger{}))
c.clientEventarcDCL = eventarcDcl.NewClient(c.dclConfig)

return nil
}
Expand Down
20 changes: 20 additions & 0 deletions google/dcl.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package google

import (
dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
)

var (
// CreateDirective restricts Apply to creating resources for Create
CreateDirective = []dcl.ApplyOption{
dcl.WithLifecycleParam(dcl.BlockAcquire),
dcl.WithLifecycleParam(dcl.BlockDestruction),
dcl.WithLifecycleParam(dcl.BlockModification),
}

// UpdateDirective restricts Apply to modifying resources for Update
UpdateDirective = []dcl.ApplyOption{
dcl.WithLifecycleParam(dcl.BlockCreation),
dcl.WithLifecycleParam(dcl.BlockDestruction),
}
)
38 changes: 38 additions & 0 deletions google/dcl_logger.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package google

import (
"fmt"
"log"
)

type dclLogger struct{}

// Fatal records Fatal errors.
func (l dclLogger) Fatal(args ...interface{}) {
log.Fatal(args...)
}

// Fatalf records Fatal errors with added arguments.
func (l dclLogger) Fatalf(format string, args ...interface{}) {
log.Fatalf(fmt.Sprintf("[DEBUG][DCL FATAL] %s", format), args...)
}

// Info records Info errors.
func (l dclLogger) Info(args ...interface{}) {
log.Print(args...)
}

// Infof records Info errors with added arguments.
func (l dclLogger) Infof(format string, args ...interface{}) {
log.Printf(fmt.Sprintf("[DEBUG][DCL INFO] %s", format), args...)
}

// Warningf records Warning errors with added arguments.
func (l dclLogger) Warningf(format string, args ...interface{}) {
log.Printf(fmt.Sprintf("[DEBUG][DCL WARNING] %s", format), args...)
}

// Warning records Warning errors.
func (l dclLogger) Warning(args ...interface{}) {
log.Print(args...)
}
1 change: 1 addition & 0 deletions google/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) {
"google_dataproc_cluster": resourceDataprocCluster(),
"google_dataproc_job": resourceDataprocJob(),
"google_endpoints_service": resourceEndpointsService(),
"google_eventarc_trigger": resourceEventarcTrigger(),
"google_folder": resourceGoogleFolder(),
"google_folder_organization_policy": resourceGoogleFolderOrganizationPolicy(),
"google_logging_billing_account_sink": resourceLoggingBillingAccountSink(),
Expand Down
Loading