Skip to content

Commit 2c24047

Browse files
committed
Version v0.1.0
0 parents  commit 2c24047

File tree

124 files changed

+6873
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+6873
-0
lines changed

.goreleaser.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
3+
before:
4+
hooks:
5+
# this is just an example and not a requirement for provider building/publishing
6+
- go mod tidy
7+
builds:
8+
- env:
9+
# goreleaser does not work with CGO, it could also complicate
10+
# usage by users in CI/CD systems like Terraform Cloud where
11+
# they are unable to install libraries.
12+
- CGO_ENABLED=0
13+
mod_timestamp: '{{ .CommitTimestamp }}'
14+
flags:
15+
- -trimpath
16+
ldflags:
17+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
18+
goos:
19+
- freebsd
20+
- windows
21+
- linux
22+
- darwin
23+
goarch:
24+
- amd64
25+
- '386'
26+
- arm
27+
- arm64
28+
ignore:
29+
- goos: darwin
30+
goarch: '386'
31+
binary: '{{ .ProjectName }}_v{{ .Version }}'
32+
archives:
33+
- format: zip
34+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
35+
format_overrides:
36+
- goos: freebsd
37+
format: zip
38+
- goos: windows
39+
format: zip
40+
- goos: linux
41+
format: zip
42+
- goos: darwin
43+
format: zip
44+
checksum:
45+
extra_files:
46+
- glob: 'terraform-registry-manifest.json'
47+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
48+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
49+
algorithm: sha256
50+
signs:
51+
- artifacts: checksum
52+
args:
53+
# if you are using this in a GitHub action or some other automated pipeline, you
54+
# need to pass the batch flag to indicate its not interactive.
55+
- "--batch"
56+
- "--local-user"
57+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
58+
- "--output"
59+
- "${signature}"
60+
- "--detach-sign"
61+
- "${artifact}"
62+
release:
63+
extra_files:
64+
- glob: 'terraform-registry-manifest.json'
65+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
66+
# If you want to manually examine the release before its live, uncomment this line:
67+
# draft: true
68+
changelog:
69+
skip: true

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This GitHub action can publish assets for release when a tag is created.
2+
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
3+
#
4+
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
5+
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
6+
# secret. If you would rather own your own GPG handling, please fork this action
7+
# or use an alternative one for key handling.
8+
#
9+
# You will need to pass the `--batch` flag to `gpg` in your signing step
10+
# in `goreleaser` to indicate this is being used in a non-interactive mode.
11+
#
12+
name: release
13+
on:
14+
push:
15+
tags:
16+
- 'v*'
17+
jobs:
18+
goreleaser:
19+
runs-on: ubuntu-latest
20+
steps:
21+
-
22+
name: Checkout
23+
uses: actions/checkout@v3
24+
-
25+
name: Unshallow
26+
run: git fetch --prune --unshallow
27+
-
28+
name: Set up Go
29+
uses: actions/setup-go@v2
30+
with:
31+
go-version: 1.14
32+
-
33+
name: Import GPG key
34+
id: import_gpg
35+
uses: hashicorp/ghaction-import-gpg@v2.1.0
36+
env:
37+
# These secrets will need to be configured for the repository:
38+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
39+
PASSPHRASE: ${{ secrets.PASSPHRASE }}
40+
-
41+
name: Run GoReleaser
42+
uses: goreleaser/goreleaser-action@v2.9.1
43+
with:
44+
version: latest
45+
args: release --rm-dist
46+
env:
47+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
48+
# GitHub sets this automatically
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/examples/**/.terraform
2+
/examples/**/.terraform.lock.hcl
3+
/examples/**/terraform.tfstate
4+
/.vscode
5+
/.terraform
6+
/.terraform.lock.hcl
7+
/terraform.tfstate

README.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Terraform Custom Provider - Stackbill
2+
3+
The goal of this project is to create Stackbill resources via terraform
4+
5+
## Description
6+
7+
This would help us to create the stackbill resources via Terraform.
8+
9+
## Requirements
10+
- [Terraform](https://www.terraform.io/downloads.html) 1.1.x
11+
- [Go](https://golang.org/doc/install) 1.17 (to build the provider plugin)
12+
13+
[![N|Stackbill](https://www.stackbill.com/wp-content/uploads/2017/11/stackbill-logo-white.png)](https://www.stackbill.com/)
14+
15+
## Usage
16+
- Clone this repository
17+
- Run install.sh file
18+
19+
## Examples
20+
Provider configuration
21+
22+
```
23+
# This is required for Terraform 0.13+
24+
terraform {
25+
required_providers {
26+
stackbill = {
27+
source = "stackbill/stackbill"
28+
version = "0.1.0"
29+
}
30+
}
31+
}
32+
33+
provider "stackbill" {
34+
api_key = "Place your api key here"
35+
secret_key = "Place your secret key here"
36+
url = "Place your api url here"
37+
}
38+
```
39+
40+
# Resource example - Instance Creation
41+
```
42+
resource "stackbill_instance" "my-server" {
43+
compute_offering_uuid = "2f7b1b02-078f-42fb-aece-aa21bfa89e1a"
44+
cpu_core = "3"
45+
# disk_size = 0
46+
hypervisor_name = "string"
47+
# memory = "0"
48+
name = "AzTestingVmFour"
49+
network_uuid = "0c7cc302-abe5-4687-8351-26aba55b3d0d"
50+
# security_group_name = "string"
51+
# ssh_key_name = "string"
52+
# storage_offering_uuid = "string"
53+
template_uuid = "e39172b4-715b-44ac-ada2-7f97f733eecc"
54+
zone_uuid = "74b12720-73ce-49b6-857f-48cdac6dcd3f"
55+
}
56+
# - Optional values
57+
```
58+
59+
# Dataset example - Compute offering list
60+
```
61+
data "stackbill_compute_offering_list" "all" {
62+
zone_uuid = "74b12720-73ce-49b6-857f-48cdac6dcd3f"
63+
#uuid = "c674ac49-32cd-4aae-96f8-25458bded6ad"
64+
}
65+
66+
# Display compute offering list
67+
output "all_compute_offerings" {
68+
value = data.stackbill_compute_offering_list.all.computeofferings
69+
}
70+
# - Optional values
71+
```

api/api.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package api
2+
3+
var (
4+
// End Point
5+
EndPoint = "http://wolfapp.assistanz24x7.com/restapi"
6+
// End Point
7+
END_POINT = ""
8+
// Secret Key
9+
SECRET_KEY = ""
10+
// Api Key
11+
API_KEY = ""
12+
)

api/compute_offering_api_routes.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package api
2+
3+
var (
4+
computeOfferingList = "compute/computeOfferingList"
5+
)
6+
7+
// Compute Offering List Api
8+
func GetComputeOfferingListApi(zoneUuid string) string {
9+
return END_POINT + "/" + computeOfferingList + "?zoneUuid=" + zoneUuid
10+
}

api/instance_api_routes.go

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
package api
2+
3+
var (
4+
instancePostApi = "instance/createInstance"
5+
instanceNameUpdateApi = "instance/updateInstanceName"
6+
instanceStart = "instance/startInstance"
7+
instanceStop = "instance/stopInstance"
8+
instanceDelete = "instance/destroyInstance"
9+
instanceResize = "instance/resizeVm"
10+
instanceList = "instance/instanceList"
11+
instanceAttachIso = "instance/attachIso"
12+
instanceDetachIso = "instance/detachIso"
13+
instanceStatus = "instance/vmStatus"
14+
)
15+
16+
// Instance create api
17+
func GetInstanceCreateApi() string {
18+
return END_POINT + "/" + instancePostApi
19+
}
20+
21+
// Instance name update api
22+
func GetInstanceNameUpdateApi() string {
23+
return END_POINT + "/" + instanceNameUpdateApi
24+
}
25+
26+
// Start instance api
27+
func GetInstanceStartApi() string {
28+
return END_POINT + "/" + instanceStart
29+
}
30+
31+
// Stop instance api
32+
func GetInstanceStopApi() string {
33+
return END_POINT + "/" + instanceStop
34+
}
35+
36+
// Delete instance api
37+
func GetInstanceDeleteApi() string {
38+
return END_POINT + "/" + instanceDelete
39+
}
40+
41+
// Instance Resize api
42+
func GetInstanceResizeApi() string {
43+
return END_POINT + "/" + instanceResize
44+
}
45+
46+
// Instance List api
47+
func GetInstanceListApi(zoneId string) string {
48+
return END_POINT + "/" + instanceList + "?zoneUuid=" + zoneId
49+
}
50+
51+
// Instace Attach Iso
52+
func GetInstanceAttachIsoApi(uuid string, isoUUid string) string {
53+
return END_POINT + "/" + instanceAttachIso + "?uuid=" + uuid + "&isoUuid=" + isoUUid
54+
}
55+
56+
// Instace Detach Iso
57+
func GetInstanceDetachIsoApi(uuid string, isoUUid string) string {
58+
return END_POINT + "/" + instanceDetachIso + "?uuid=" + uuid + "&isoUuid=" + isoUUid
59+
}
60+
61+
// Instance status api
62+
func GetInstanceStatusApi(uuid string) string {
63+
return END_POINT + "/" + instanceStatus + "?uuid=" + uuid
64+
}

api/network_api_routes.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package api
2+
3+
import "strconv"
4+
5+
var (
6+
networkList = "network/networkList"
7+
networkOfferingList = "networkoffering/networkOfferingList"
8+
vpcNetworkOfferingList = "networkoffering/vpcNetworkOfferingList"
9+
networkCreate = "network/createNetwork"
10+
networkDelete = "network/deleteNetwork"
11+
vmNetworkAdd = "instance/attachNetwork"
12+
vmNetworkDelete = "instance/detachNetwork"
13+
)
14+
15+
// Network List api
16+
func GetNewNetworkListApi(zoneUuid string) string {
17+
return END_POINT + "/" + networkList + "?zoneUuid=" + zoneUuid
18+
}
19+
20+
// Network Offering List api
21+
func GetNewNetworkOfferingListApi(zoneUuid string) string {
22+
return END_POINT + "/" + networkOfferingList + "?zoneUuid=" + zoneUuid
23+
}
24+
25+
// Network Offering List api
26+
func GetNewVpcNetworkOfferingListApi() string {
27+
return END_POINT + "/" + vpcNetworkOfferingList
28+
}
29+
30+
// Network Offering List api
31+
func GetNetworkCreateApi(isPublic bool, securityGroupId string) string {
32+
secrityGroup := ""
33+
if securityGroupId != "" {
34+
secrityGroup = "&securityGroupId=" + securityGroupId
35+
}
36+
return END_POINT + "/" + networkCreate + "?isPublic=" + strconv.FormatBool(isPublic) + secrityGroup
37+
}
38+
39+
// Network Offering List api
40+
func GetNetworkDeleteApi(uuid string) string {
41+
return END_POINT + "/" + networkDelete + "/" + uuid
42+
}
43+
44+
// Network Attach api
45+
func GetVmNetworkAddApi() string {
46+
return END_POINT + "/" + vmNetworkAdd
47+
}
48+
49+
// Network Attach api
50+
func GetVmNetworkDeleteApi() string {
51+
return END_POINT + "/" + vmNetworkDelete
52+
}

api/security_group_api_routes.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package api
2+
3+
var (
4+
securityGroupApiList = "securitygroup/securityList"
5+
)
6+
7+
// Security Group Api
8+
func GetSecurityGroupListApi() string {
9+
return END_POINT + "/" + securityGroupApiList
10+
}

api/sshkeys_api_routes.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package api
2+
3+
var (
4+
sshKeyList = "sshkey/sshkeyList"
5+
resetSshKey = "instance/resetSSHkey"
6+
)
7+
8+
// SshKey List api
9+
func GetSshkeyListApi() string {
10+
return END_POINT + "/" + sshKeyList
11+
}
12+
13+
// SshKey List api
14+
func GetResetSshkeyApi(uuid string, sshKeyId string) string {
15+
return END_POINT + "/" + resetSshKey + "?uuid=" + uuid + "&sshUuid=" + sshKeyId
16+
}

0 commit comments

Comments
 (0)