Skip to content

Commit

Permalink
Merge branch 'master' of github-squadcast:GoogleCloudPlatform/terrafo…
Browse files Browse the repository at this point in the history
…rmer
  • Loading branch information
Mohammad Muazam committed Sep 7, 2022
2 parents a8e0f6f + eb291a7 commit 2561358
Show file tree
Hide file tree
Showing 57 changed files with 2,199 additions and 250 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ A CLI tool that generates `tf`/`json` and `tfstate` files based on existing infr
* [RabbitMQ](/docs/rabbitmq.md)
* Network
* [Cloudflare](/docs/cloudflare.md)
* [Myrasec](/docs/myrasec.md)
* [PAN-OS](/docs/panos.md)
* VCS
* [Azure DevOps](/docs/azuredevops.md)
Expand All @@ -54,6 +55,7 @@ A CLI tool that generates `tf`/`json` and `tfstate` files based on existing infr
* [Mackerel](/docs/mackerel.md)
* [PagerDuty](/docs/pagerduty.md)
* [Opsgenie](/docs/opsgenie.md)
* [Honeycomb.io](/docs/honeycombio.md)
* [SquadCast](/docs/squadcast.md)
* Community
* [Keycloak](/docs/keycloak.md)
Expand Down Expand Up @@ -290,6 +292,7 @@ Links to download Terraform Providers:
* Kubernetes provider >=1.9.0 - [here](https://releases.hashicorp.com/terraform-provider-kubernetes/)
* RabbitMQ provider >=1.1.0 - [here](https://releases.hashicorp.com/terraform-provider-rabbitmq/)
* Network
* Myrasec provider >1.44 - [here](https://github.com/Myra-Security-GmbH/terraform-provider-myrasec)
* Cloudflare provider >1.16 - [here](https://releases.hashicorp.com/terraform-provider-cloudflare/)
* Fastly provider >0.16.1 - [here](https://releases.hashicorp.com/terraform-provider-fastly/)
* NS1 provider >1.8.3 - [here](https://releases.hashicorp.com/terraform-provider-ns1/)
Expand All @@ -302,6 +305,7 @@ Links to download Terraform Providers:
* Mackerel provider > 0.0.6 - [here](https://github.com/mackerelio-labs/terraform-provider-mackerel)
* Pagerduty >=1.9 - [here](https://releases.hashicorp.com/terraform-provider-pagerduty/)
* Opsgenie >= 0.6.0 [here](https://releases.hashicorp.com/terraform-provider-opsgenie/)
* Honeycomb.io >= 0.10.0 - [here](https://github.com/honeycombio/terraform-provider-honeycombio/releases)
* SquadCast provider >= 1.0.4 - [here](https://github.com/SquadcastHub/terraform-provider-squadcast)
* Community
* Keycloak provider >=1.19.0 - [here](https://github.com/mrparkers/terraform-provider-keycloak/)
Expand Down
47 changes: 47 additions & 0 deletions cmd/provider_cmd_honeycombio.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright 2022 The Terraformer Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package cmd

import (
honeycombio_terraforming "github.com/GoogleCloudPlatform/terraformer/providers/honeycombio"

"github.com/GoogleCloudPlatform/terraformer/terraformutils"
"github.com/spf13/cobra"
)

func newCmdHoneycombioImporter(options ImportOptions) *cobra.Command {
cmd := &cobra.Command{
Use: "honeycombio",
Short: "Import current state to Terraform configuration from Honeycomb.io",
Long: "Import current state to Terraform configuration from Honeycomb.io",
RunE: func(cmd *cobra.Command, args []string) error {
provider := newHoneycombProvider()
err := Import(provider, options, options.Projects)
if err != nil {
return err
}
return nil
},
}

cmd.AddCommand(listCmd(newHoneycombProvider()))
baseProviderFlags(cmd.PersistentFlags(), &options, "derived_column,board", "board=id1,id2")
cmd.PersistentFlags().StringSliceVarP(&options.Projects, "datasets", "", []string{}, "hello-service,goodbye-service")

return cmd
}

func newHoneycombProvider() terraformutils.ProviderGenerator {
return &honeycombio_terraforming.HoneycombProvider{}
}
37 changes: 37 additions & 0 deletions cmd/provider_cmd_myrasec.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package cmd

import (
myrasec_terraforming "github.com/GoogleCloudPlatform/terraformer/providers/myrasec"
"github.com/GoogleCloudPlatform/terraformer/terraformutils"
"github.com/spf13/cobra"
)

//
// newCmdMyrasecImporter
//
func newCmdMyrasecImporter(options ImportOptions) *cobra.Command {
cmd := &cobra.Command{
Use: "myrasec",
Short: "Import current state to Terraform configuration from Myra Security",
Long: "Import current state to Terraform configuration from Myra Security",
RunE: func(cmd *cobra.Command, args []string) error {
provider := newMyrasecProvider()
err := Import(provider, options, []string{})
if err != nil {
return err
}
return nil
},
}

cmd.AddCommand(listCmd(newMyrasecProvider()))
baseProviderFlags(cmd.PersistentFlags(), &options, "domain", "")
return cmd
}

//
// newMyrasecProvider
//
func newMyrasecProvider() terraformutils.ProviderGenerator {
return &myrasec_terraforming.MyrasecProvider{}
}
4 changes: 4 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func providerImporterSubcommands() []func(options ImportOptions) *cobra.Command
newCmdOctopusDeployImporter,
newCmdRabbitMQImporter,
// Network
newCmdMyrasecImporter,
newCmdCloudflareImporter,
newCmdFastlyImporter,
newCmdNs1Importer,
Expand All @@ -75,6 +76,7 @@ func providerImporterSubcommands() []func(options ImportOptions) *cobra.Command
newCmdGrafanaImporter,
newCmdPagerDutyImporter,
newCmdOpsgenieImporter,
newCmdHoneycombioImporter,
newCmdSquadcastImporter,
// Community
newCmdKeycloakImporter,
Expand Down Expand Up @@ -114,6 +116,7 @@ func providerGenerators() map[string]func() terraformutils.ProviderGenerator {
newOctopusDeployProvider,
newRabbitMQProvider,
// Network
newMyrasecProvider,
newCloudflareProvider,
// VCS
newAzureDevOpsProvider,
Expand All @@ -124,6 +127,7 @@ func providerGenerators() map[string]func() terraformutils.ProviderGenerator {
newDataDogProvider,
newNewRelicProvider,
newPagerDutyProvider,
newHoneycombProvider,
// Community
newKeycloakProvider,
newLogzioProvider,
Expand Down
24 changes: 24 additions & 0 deletions docs/honeycombio.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### Use with Honeycomb.io

Example:

```
export HONEYCOMB_API_KEY=MYAPIKEY
./terraformer import honeycombio --resources=board,trigger
```

List of supported Honeycomb resources:

* `board`
* `honeycombio_board`
* `honeycombio_query`
* `honeycombio_query_annotation`
* `derived_column`
* `honeycombio_derived_column`
* `trigger`
* `honeycombio_trigger`
* `honeycombio_query`
* `slo`
* `honeycombio_slo`
* `honeycombio_burn_alert`
* `honeycombio_derived_column`
31 changes: 31 additions & 0 deletions docs/myrasec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
### Use with Myra Security

Example using a Myra Security API Key and corresponding Token:

```
export MYRASEC_API_SECRET=[MYRASEC_API_SECRET]
export MYRASEC_API_TOKEN=[MYRASEC_API_TOKEN]
./terraformer import myrasec --resources=domain
```

List of supported Myra Security services:
* `domain`
* `myrasec_domain`
* `dns`
* `myrasec_dns_record`
* `redirect`
* `myrasec_redirect`
* `cache_setting`
* `myrasec_cache_setting`
* `ratelimit`
* `myrasec_ratelimit`
* `ip_filter`
* `myrasec_ip_filter`
* `settings`
* `myrasec_settings`
* `waf_rule`
* `myrasec_waf_rule`
* `maintenance`
* `myrasec_maintenance`
* `error_page`
* `myrasec_error_page`
Loading

0 comments on commit 2561358

Please sign in to comment.