Skip to content

Commit

Permalink
fix:adds log-sink writer id to the export-terraform fn (#884)
Browse files Browse the repository at this point in the history
* fix:adds log-sink writer id to the export-terraform fn

* Update functions/go/export-terraform/terraformgenerator/templates/log-export.tf

Co-authored-by: Bharath KKB <bharathkrishnakb@gmail.com>

* fix version in testdata

Co-authored-by: Awais Malik <awmalik@google.com>
Co-authored-by: Bharath KKB <bharathkrishnakb@gmail.com>
  • Loading branch information
3 people committed Jul 1, 2022
1 parent 56c6212 commit 61dfa1b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ module "{{ .GetResourceName }}-destination" {
{{end}}{{with $logsink.References.LoggingLogBucket }}
module "{{ .GetResourceName }}-destination" {
source = "terraform-google-modules/log-export/google//modules/logbucket"
version = "~> 7.4.0"
version = "~> 7.4.1"

project_id = module.{{ .Parent.GetResourceName }}.project_id
name = "{{ .GetResourceName }}"{{ with .GetStringFromObject "spec" "location" }}
location = "{{.}}"{{end}}{{ if .GetInt "spec" "retentionDays" }}
retention_days = {{ .GetInt "spec" "retentionDays" }}{{end}}
project_id = module.{{ .Parent.GetResourceName }}.project_id
name = "{{ .GetResourceName }}"{{ with .GetStringFromObject "spec" "location" }}
location = "{{.}}"{{end}}{{ if .GetInt "spec" "retentionDays" }}
retention_days = {{ .GetInt "spec" "retentionDays" }}{{end}}
log_sink_writer_identity = module.logsink-{{ $logsink.GetResourceName }}.writer_identity
}
{{end}}{{end}}
11 changes: 6 additions & 5 deletions functions/go/export-terraform/testdata/log/tf/log-export.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ module "logsink-123456789012-orglogbucketsink" {

module "my-log-k8s-bucket-destination" {
source = "terraform-google-modules/log-export/google//modules/logbucket"
version = "~> 7.4.0"
version = "~> 7.4.1"

project_id = module.prj-logging.project_id
name = "my-log-k8s-bucket"
location = "global"
retention_days = 30
project_id = module.prj-logging.project_id
name = "my-log-k8s-bucket"
location = "global"
retention_days = 30
log_sink_writer_identity = module.logsink-123456789012-orglogbucketsink.writer_identity
}

module "logsink-123456789012-pubsubsink" {
Expand Down

0 comments on commit 61dfa1b

Please sign in to comment.