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

Add support public BizflyCloud provider #1896

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ A CLI tool that generates `tf`/`json` and `tfstate` files based on existing infr
* [IBM Cloud](/docs/ibmcloud.md)
* Cloud
* [DigitalOcean](/docs/digitalocean.md)
* [BizflyCloud](/docs/bizflycloud.md)
* [Equinix Metal](/docs/equinixmetal.md)
* [Fastly](/docs/fastly.md)
* [Heroku](/docs/heroku.md)
Expand Down Expand Up @@ -280,6 +281,7 @@ Links to download Terraform provider plugins:
* Alicloud provider >1.57.1 - [here](https://releases.hashicorp.com/terraform-provider-alicloud/)
* Cloud
* DigitalOcean provider >1.9.1 - [here](https://releases.hashicorp.com/terraform-provider-digitalocean/)
* BizflyCloud provider >=0.1.11 - [here](https://github.com/bizflycloud/terraform-provider-bizflycloud/releases)
* Heroku provider >2.2.1 - [here](https://releases.hashicorp.com/terraform-provider-heroku/)
* LaunchDarkly provider >=2.1.1 - [here](https://releases.hashicorp.com/terraform-provider-launchdarkly/)
* Linode provider >1.8.0 - [here](https://releases.hashicorp.com/terraform-provider-linode/)
Expand Down
44 changes: 44 additions & 0 deletions cmd/provider_cmd_bizflycloud.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2024 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 (
bizflycloud_terraforming "github.com/GoogleCloudPlatform/terraformer/providers/bizflycloud"
"github.com/GoogleCloudPlatform/terraformer/terraformutils"
"github.com/spf13/cobra"
)

func newCmdBizflyCloudImporter(options ImportOptions) *cobra.Command {
cmd := &cobra.Command{
Use: "bizflycloud",
Short: "Import current state to Terraform configuration from Bizfly Cloud",
Long: "Import current state to Terraform configuration from Bizfly Cloud",
RunE: func(cmd *cobra.Command, args []string) error {
provider := newBizflyCloudProvider()
err := Import(provider, options, []string{})
if err != nil {
return err
}
return nil
},
}

cmd.AddCommand(listCmd(newBizflyCloudProvider()))
baseProviderFlags(cmd.PersistentFlags(), &options, "instance", "instance=name1:name2:name3")
return cmd
}

func newBizflyCloudProvider() terraformutils.ProviderGenerator {
return &bizflycloud_terraforming.BizflyCloudProvider{}
}
2 changes: 2 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ func providerImporterSubcommands() []func(options ImportOptions) *cobra.Command
newCmdVultrImporter,
newCmdYandexImporter,
newCmdIonosCloudImporter,
newCmdBizflyCloudImporter,
// Infrastructure Software
newCmdKubernetesImporter,
newCmdOctopusDeployImporter,
Expand Down Expand Up @@ -112,6 +113,7 @@ func providerGenerators() map[string]func() terraformutils.ProviderGenerator {
newOpenStackProvider,
newTencentCloudProvider,
newVultrProvider,
newBizflyCloudProvider,
// Infrastructure Software
newKubernetesProvider,
newOctopusDeployProvider,
Expand Down
33 changes: 33 additions & 0 deletions docs/bizflycloud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
### Use with BizflyCloud

Example:

```
export BIZFLYCLOUD_PROJECT_ID=[BIZFLYCLOUD_PROJECT_ID]
export BIZFLYCLOUD_REGION=[BIZFLYCLOUD_REGION]
export BIZFLYCLOUD_EMAIL=[BIZFLYCLOUD_EMAIL]
export BIZFLYCLOUD_PASSWORD=[BIZFLYCLOUD_PASSWORD]
./terraformer import bizflycloud -r server,database
```

List of supported BizflyCloud resources:

* `server`
* `bizflycloud_server`
* `bizflycloud_network_interface_attachment`
* `bizflycloud_network_interface`
* `bizflycloud_volume_attachment`
* `bizflycloud_volume`
* `bizflycloud_vpc_network`
* `bizflycloud_wan_ip`
* `bizflycloud_firewall`
* `bizflycloud_ssh_key`
* `database`
* `bizflycloud_cloud_database_instance`
* `load_balancer`
* `bizflycloud_loadbalancer`
* `bizflycloud_loadbalancer_listener`
* `bizflycloud_loadbalancer_l7policy`
* `bizflycloud_loadbalancer_pool`
* `kubernetes_engine`
* `bizflycloud_kubernetes`
22 changes: 12 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ require (
github.com/zclconf/go-cty v1.11.0
github.com/zorkian/go-datadog-api v2.30.0+incompatible
golang.org/x/oauth2 v0.12.0
golang.org/x/text v0.14.0
golang.org/x/text v0.16.0
gonum.org/v1/gonum v0.7.0
google.golang.org/api v0.131.0
google.golang.org/genproto v0.0.0-20230629202037-9506855d4529
Expand Down Expand Up @@ -196,7 +196,7 @@ require github.com/newrelic/newrelic-client-go v0.79.0
require (
github.com/Azure/azure-pipeline-go v0.2.2 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.18 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.23 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.4 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
Expand Down Expand Up @@ -253,7 +253,7 @@ require (
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/jsonapi v1.0.0 // indirect
Expand Down Expand Up @@ -321,14 +321,14 @@ require (
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.mongodb.org/mongo-driver v1.7.5 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect
golang.org/x/tools v0.6.0 // indirect
golang.org/x/tools v0.23.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/grpc v1.56.3 // indirect
Expand Down Expand Up @@ -376,7 +376,7 @@ require (
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.5 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/golang-jwt/jwt/v4 v4.4.3 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.5 // indirect
Expand All @@ -393,6 +393,7 @@ require (
)

require (
github.com/bizflycloud/gobizfly v1.1.3
github.com/gofrs/uuid/v3 v3.1.2
github.com/ionos-cloud/sdk-go-cert-manager v1.0.0
github.com/ionos-cloud/sdk-go-container-registry v1.0.0
Expand All @@ -419,6 +420,7 @@ require (
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tat v1.0.392
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tcaplusdb v1.0.392
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/vpc v1.0.392
golang.org/x/exp v0.0.0-20240707233637-46b078467d37
)

replace gopkg.in/jarcoal/httpmock.v1 => github.com/jarcoal/httpmock v1.0.5
Expand Down
Loading