From 12bcc9ac57ecec36149c75d3925ee29be079437d Mon Sep 17 00:00:00 2001 From: RouxAntoine Date: Mon, 22 Mar 2021 00:17:15 +0100 Subject: [PATCH] Add code for slack bot and deployment --- .dockerignore | 8 ++++ .gitignore | 11 +++++ Dockerfile | 53 ++++++++++++++++++++++ Makefile | 19 ++++++++ cmd/main.go | 74 +++++++++++++++++++++++++++++++ config.sample.hcl | 3 ++ go.mod | 9 ++++ go.sum | 82 +++++++++++++++++++++++++++++++++++ manifests/.gitignore | 34 +++++++++++++++ manifests/.terraform.lock.hcl | 21 +++++++++ manifests/common.tf | 72 ++++++++++++++++++++++++++++++ manifests/configure.tf | 28 ++++++++++++ manifests/variable.tf | 23 ++++++++++ pkg/check/command.go | 24 ++++++++++ pkg/notify/slack.go | 51 ++++++++++++++++++++++ 15 files changed, 512 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 cmd/main.go create mode 100644 config.sample.hcl create mode 100644 go.mod create mode 100644 go.sum create mode 100644 manifests/.gitignore create mode 100644 manifests/.terraform.lock.hcl create mode 100644 manifests/common.tf create mode 100644 manifests/configure.tf create mode 100644 manifests/variable.tf create mode 100644 pkg/check/command.go create mode 100644 pkg/notify/slack.go diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..cb38235 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,8 @@ +bin/ +.vscode/ +.git/ +*.log +config.hcl +Dockerfile +.gitignore +manifests/ \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e78496a --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +.idea/ + +.vscode/ +!.vscode/launch.json + +bin/ +!bin/.gitkeep + +*.log + +config.hcl \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..974e82b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +FROM --platform=$BUILDPLATFORM golang:1.16.0-alpine3.13 AS builder +# ex. amd64 +ARG TARGETARCH +# ex. linux/amd64 +ARG BUILDPLATFORM + +RUN apk update && \ + apk add --no-cache git ca-certificates tzdata gcc libc-dev && \ + update-ca-certificates + +ENV USER=appuser +ENV UID=10001 +ENV GID=10001 +WORKDIR /data + +RUN addgroup \ + --gid "${GID}" \ + "${USER}" && \ + adduser \ + --disabled-password \ + --gecos "" \ + --home "/nonexistent" \ + --shell "/sbin/nologin" \ + --no-create-home \ + --uid "${UID}" \ + -G "${USER}" \ + "${USER}" + +COPY go.mod . +COPY go.sum . +RUN go mod download && \ + go mod verify + +COPY . . +RUN export GOARCH=$TARGETARCH; \ + export GOOS=$(echo $BUILDPLATFORM | cut -d'/' -f1); \ + export GOBUILDFLAGS="-a -tags netgo -installsuffix netgo"; \ + export LDFLAGS="-w -s -d"; \ + export CGO_ENABLED=0; \ + go build -o bin/bot-$GOOS-$GOARCH cmd/main.go + +FROM scratch + +USER appuser:appuser + +COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=builder /etc/passwd /etc/passwd +COPY --from=builder /etc/group /etc/group +COPY --from=builder --chown=appuser:appuser /data/bin/* /go/bin/bot + +WORKDIR /go +ENTRYPOINT ["/go/bin/bot"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6a7a247 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +.PHONY: docker-build + +BOT_VERSION=latest +GOARCH=amd64 +# GOARCH=arm +GOOS=darwin +# GOOS=linux + +build: dependencies + @echo "build for os $(GOOS) and arch $(GOARCH)" + go build -o bin/slackbot-$(GOOS)-$(GOARCH) cmd/main.go + +dependencies: + go mod download + go mod verify + +docker-build: + DOCKER_BUILDKIT=1 docker build --force-rm -t docker.registry:5000/slackbot:$(BOT_VERSION) . + docker push docker.registry:5000/slackbot:$(BOT_VERSION) \ No newline at end of file diff --git a/cmd/main.go b/cmd/main.go new file mode 100644 index 0000000..0aef728 --- /dev/null +++ b/cmd/main.go @@ -0,0 +1,74 @@ +package main + +import ( + "flag" + "fmt" + "go/slack-bot/pkg/check" + "go/slack-bot/pkg/notify" + "io/ioutil" + "log" + "os" + "path/filepath" + + "github.com/hashicorp/hcl/v2" + "github.com/hashicorp/hcl/v2/gohcl" + "github.com/hashicorp/hcl/v2/hclsyntax" +) + +type SlackConf struct { + BotID string `hcl:"bot_id"` + DestChannelID string `hcl:"dest_channel_id"` + WebhookID string `hcl:"webhook_id"` +} + +func main() { + var configFile string + flag.StringVar(&configFile, "config", "config.hcl", "hcl application configuration file") + flag.Parse() + + conf := ParseConfiguration(configFile) + slackNotifier := notify.NewSlackNotifier(conf.BotID, conf.DestChannelID, conf.WebhookID) + + msg := check.NewCliChecker(). + Check() + + slackNotifier.Notify(msg) +} + +//ParseConfiguration take filename path and parse it to Config.SlackConf +func ParseConfiguration(filename string) *SlackConf { + dir, err := os.Getwd() + if err != nil { + log.Fatalf("Fail to determine current directory to load default ./config.hcl file, %+v\n", err) + } + log.Printf("current dir is %s", dir) + + if filename == "config.hcl" { + filename = fmt.Sprintf("%s%c%s", dir, os.PathSeparator, filename) + } + relativeFilename, err := filepath.Rel(dir, filename) + if err != nil { + log.Fatalf("Fail to determine configuration relative directory for file %s, %+v", filename, err) + } + + src, err := ioutil.ReadFile(relativeFilename) + if err != nil { + log.Fatalf("Missing required parameter filename got : %s, %+v", relativeFilename, err) + } + file, diags := hclsyntax.ParseConfig(src, relativeFilename, hcl.Pos{Line: 1, Column: 1}) + if diags.HasErrors() { + log.Fatalf("parse config error, %s", diags.Error()) + } + + config := &SlackConf{} + + diags = gohcl.DecodeBody(file.Body, nil, config) + if diags.HasErrors() { + log.Fatalf("error config decode, %s", diags.Error()) + } + + if config.BotID == "" || config.DestChannelID == "" || config.WebhookID == "" { + log.Fatal("Missing required parameter : bot_id, dest_channel_id or webhook_id") + } + return config +} diff --git a/config.sample.hcl b/config.sample.hcl new file mode 100644 index 0000000..9b656df --- /dev/null +++ b/config.sample.hcl @@ -0,0 +1,3 @@ +bot_id = "" +dest_channel_id = "" +webhook_id = "" \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..023e4a2 --- /dev/null +++ b/go.mod @@ -0,0 +1,9 @@ +module go/slack-bot + +go 1.16 + +require ( + github.com/hashicorp/hcl/v2 v2.9.1 + github.com/pkg/errors v0.9.1 // indirect + github.com/slack-go/slack v0.8.2 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..37d6507 --- /dev/null +++ b/go.sum @@ -0,0 +1,82 @@ +github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= +github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 h1:ZSTrOEhiM5J5RFxEaFvMZVEAM1KvT1YzbEOwB2EAGjA= +github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= +github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= +github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= +github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/go-test/deep v1.0.4 h1:u2CU3YKy9I2pmu9pX0eq50wCgjfGIt539SqR7FbHiho= +github.com/go-test/deep v1.0.4/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hashicorp/hcl/v2 v2.9.1 h1:eOy4gREY0/ZQHNItlfuEZqtcQbXIxzojlP301hDpnac= +github.com/hashicorp/hcl/v2 v2.9.1/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= +github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= +github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= +github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/slack-go/slack v0.8.2 h1:D7jNu0AInBfdQ4QyKPtVSp+ZxQes3EzWW17RZ/va4JE= +github.com/slack-go/slack v0.8.2/go.mod h1:FGqNzJBmxIsZURAxh2a8D21AnOVvvXZvGligs4npPUM= +github.com/spf13/pflag v1.0.2 h1:Fy0orTDgHdbnzHcsOgfCN4LtHf0ec3wwtiwJqwvf3Gc= +github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/vmihailenco/msgpack v3.3.3+incompatible h1:wapg9xDUZDzGCNFlwc5SqI1rvcciqcxEHac4CYj89xI= +github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U= +github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= +github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= +github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= +github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= +github.com/zclconf/go-cty v1.8.0 h1:s4AvqaeQzJIu3ndv4gVIhplVD0krU+bgrcLSVUnaWuA= +github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= +github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b h1:FosyBZYxY34Wul7O/MSKey3txpPYyCqVO5ZyceuQJEI= +github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734 h1:p/H982KKEjUnLJkM3tt/LemDnOc1GiZL5FCVlORJ5zo= +golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f h1:wMNYb4v58l5UBM7MYRLPG6ZhfOqbKu7X5eyFl8ZhKvA= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82 h1:vsphBvatvfbhlb4PO1BYSr9dzugGxJ/SQHoNufZJq1w= +golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e h1:FDhOuMEY4JVRztM/gsbk+IKUQ8kj74bxZrgw87eMMVc= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/manifests/.gitignore b/manifests/.gitignore new file mode 100644 index 0000000..70c2a9f --- /dev/null +++ b/manifests/.gitignore @@ -0,0 +1,34 @@ +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log + +# Exclude all .tfvars files, which are likely to contain sentitive data, such as +# password, private keys, and other secrets. These should not be part of version +# control as they are data points which are potentially sensitive and subject +# to change depending on the environment. +# +*.tfvars + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Include override files you do wish to add to version control using negated pattern +# +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# Ignore CLI configuration files +.terraformrc +terraform.rc \ No newline at end of file diff --git a/manifests/.terraform.lock.hcl b/manifests/.terraform.lock.hcl new file mode 100644 index 0000000..e89a02d --- /dev/null +++ b/manifests/.terraform.lock.hcl @@ -0,0 +1,21 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/kubernetes" { + version = "2.0.3" + constraints = ">= 2.0.0" + hashes = [ + "h1:u3QLP3ca1ZYtdx4t9LrNLzAA3HY/GAT06hznb2pqNC4=", + "zh:3847733636ed2aca8694227ee6936fecc6cec9573818ecf64acc2a01a4fb3ae4", + "zh:44d3e88227174d2e51e0273e732e54bb5f5d8150bbf1adecd2be198c857a0264", + "zh:7c147baeac90ddc71b8c106409dc2e06e6fe04448a0ae36c7ef919b8b27c8d5f", + "zh:832ebd1eec844fdc00ecbc5e694ecf532d0c7a94f2a1697ea0c7bc159696d529", + "zh:920c8f64925d346a0621aadede6a4ac1bbe650f16c2074a0a6b5eeb7a5c35cf7", + "zh:a26906cd3aeb28f402972154dbb3ae1ac6d739ce3e4b00906c9d4b1e263d5a56", + "zh:a7b3cbd06684f843f700ee9281c583cc593e00e3acc2c0a34f6dad4e35a1ec60", + "zh:b43c05ade832995a09c40a1c2f080586f38de1edc8c46be2e6f90b96c58a2482", + "zh:cba2a979889e79ffe48bb5ea7e63f88c344ae2cd7a341afb77b3c8d417658d6c", + "zh:e00b2ec7357a58a435a69146da3c256178caab83a6574969d4660b69996c7955", + "zh:f95f179f68aed39b8d73d7914176baf74509d74f90a1e3a600a8eb4461f8f0a3", + ] +} diff --git a/manifests/common.tf b/manifests/common.tf new file mode 100644 index 0000000..07d753b --- /dev/null +++ b/manifests/common.tf @@ -0,0 +1,72 @@ +resource "kubernetes_namespace" "monitoring_namespace" { + metadata { + name = "monitoring" + } +} + +resource "kubernetes_config_map" "slack_bot_config" { + metadata { + name = "slack-bot-hcl" + namespace = kubernetes_namespace.monitoring_namespace.id + } + data = { + "config.hcl" = <