From 159478de02fe777351e9da4c5ac1651ba227a948 Mon Sep 17 00:00:00 2001 From: becelot Date: Thu, 15 Jun 2023 21:42:36 +0200 Subject: [PATCH] feat: adds ip management resources (#21) * feat: adds cmsmgw and ipam services --------- Co-authored-by: Clemens Plieth --- cancom/provider.go | 3 +- cancom/service_aggregator.go | 4 + cancom/services/cmsmgw/provider.xx | 27 +++ cancom/services/cmsmgw/resource_gateway.xx | 55 ++++++ cancom/services/ipam/provider.go | 27 +++ cancom/services/ipam/resource_host.go | 157 ++++++++++++++++++ client/hosts.go | 8 +- client/services/cmsmgw/cmsmgw.go | 37 +++++ client/services/cmsmgw/models.go | 10 ++ client/services/ipam/ipam.go | 113 +++++++++++++ client/services/ipam/models.go | 43 +++++ docs/index.md | 1 + docs/resources/cmsmgw_gateway.md.tmplx | 15 ++ docs/resources/ipam_host.md | 42 +++++ .../cmsmgw/resources/cmsmgw_gateway.tf | 10 ++ .../services/ipam/resources/ipam_supernet.tf | 8 + go.mod | 6 +- go.sum | 23 ++- templates/resources/cmsmgw_gateway.md.tmpl | 16 ++ templates/resources/ipam_host.md.tmpl | 18 ++ 20 files changed, 612 insertions(+), 11 deletions(-) create mode 100644 cancom/services/cmsmgw/provider.xx create mode 100644 cancom/services/cmsmgw/resource_gateway.xx create mode 100644 cancom/services/ipam/provider.go create mode 100644 cancom/services/ipam/resource_host.go create mode 100644 client/services/cmsmgw/cmsmgw.go create mode 100644 client/services/cmsmgw/models.go create mode 100644 client/services/ipam/ipam.go create mode 100644 client/services/ipam/models.go create mode 100644 docs/resources/cmsmgw_gateway.md.tmplx create mode 100644 docs/resources/ipam_host.md create mode 100644 examples/services/cmsmgw/resources/cmsmgw_gateway.tf create mode 100644 examples/services/ipam/resources/ipam_supernet.tf create mode 100644 templates/resources/cmsmgw_gateway.md.tmpl create mode 100644 templates/resources/ipam_host.md.tmpl diff --git a/cancom/provider.go b/cancom/provider.go index ab02a86..833cd65 100644 --- a/cancom/provider.go +++ b/cancom/provider.go @@ -26,6 +26,7 @@ func Provider() *schema.Provider { "service_registry": { Type: schema.TypeString, Optional: true, + Description: "Service Registry to use for endpoint discovery", DefaultFunc: schema.EnvDefaultFunc("CANCOM_SERVICE_REGISTRY", "https://service-registry.portal.cancom.io"), }, }, @@ -57,7 +58,7 @@ func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{} if err != nil { diags = append(diags, diag.Diagnostic{ Severity: diag.Error, - Summary: "Failed to get services", + Summary: "Failed to get services " + service_registry, Detail: err.Error(), }) return nil, diags diff --git a/cancom/service_aggregator.go b/cancom/service_aggregator.go index 80d9fab..9bd24bd 100644 --- a/cancom/service_aggregator.go +++ b/cancom/service_aggregator.go @@ -2,8 +2,10 @@ package cancom import ( "github.com/cancom/terraform-provider-cancom/cancom/services/base" + //"github.com/cancom/terraform-provider-cancom/cancom/services/cmsmgw" "github.com/cancom/terraform-provider-cancom/cancom/services/dns" "github.com/cancom/terraform-provider-cancom/cancom/services/iam" + "github.com/cancom/terraform-provider-cancom/cancom/services/ipam" sslmonitoring "github.com/cancom/terraform-provider-cancom/cancom/services/ssl-monitoring" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -13,6 +15,8 @@ func getAllProviders() []base.ProviderI { sslmonitoring.New(), dns.New(), iam.New(), + //cmsmgw.New(), + ipam.New(), } } diff --git a/cancom/services/cmsmgw/provider.xx b/cancom/services/cmsmgw/provider.xx new file mode 100644 index 0000000..809c3a5 --- /dev/null +++ b/cancom/services/cmsmgw/provider.xx @@ -0,0 +1,27 @@ +package cmsmgw + +import ( + "github.com/cancom/terraform-provider-cancom/cancom/services/base" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +type Provider base.Provider + +func (p Provider) Name() string { + return p.ServiceName +} + +func (p Provider) Provider() *schema.Provider { + return p.ProviderSchema +} + +func New() Provider { + return Provider{ + ServiceName: "cmsmgw", + ProviderSchema: &schema.Provider{ + ResourcesMap: map[string]*schema.Resource{ + "gateway": resourceGateway(), + }, + }, + } +} diff --git a/cancom/services/cmsmgw/resource_gateway.xx b/cancom/services/cmsmgw/resource_gateway.xx new file mode 100644 index 0000000..00146c4 --- /dev/null +++ b/cancom/services/cmsmgw/resource_gateway.xx @@ -0,0 +1,55 @@ +package cmsmgw + +import ( + "context" + + "github.com/cancom/terraform-provider-cancom/client" + client_cmsmgw "github.com/cancom/terraform-provider-cancom/client/services/cmsmgw" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func resourceGateway() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceGatewayCreate, + // ReadContext: resourceGatewayRead, + // UpdateContext: resourceGatewayUpdate, + // DeleteContext: resourceGatewayDelete, + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Description: "Name of the gateway", + Required: true, + }, + }, + } +} + +func resourceGatewayCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { + c := m.(*client.Client) + + c.HostURL = c.ServiceURLs["cmsmgw"] + + var diags diag.Diagnostics + + record := &client_cmsmgw.GatewayCreateRequest{ + Name: d.Get("name").(string), + } + + resp, err := (*client_cmsmgw.Client)(c).CreateGateway(record) + + if err != nil { + return diag.FromErr(err) + } + + id := resp.ID + + d.Set("name", resp.Name) + + d.SetId(id) + + // resourceGatewayRead(ctx, d, m) + + return diags + +} diff --git a/cancom/services/ipam/provider.go b/cancom/services/ipam/provider.go new file mode 100644 index 0000000..123dc9d --- /dev/null +++ b/cancom/services/ipam/provider.go @@ -0,0 +1,27 @@ +package ipam + +import ( + "github.com/cancom/terraform-provider-cancom/cancom/services/base" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +type Provider base.Provider + +func (p Provider) Name() string { + return p.ServiceName +} + +func (p Provider) Provider() *schema.Provider { + return p.ProviderSchema +} + +func New() Provider { + return Provider{ + ServiceName: "ipam", + ProviderSchema: &schema.Provider{ + ResourcesMap: map[string]*schema.Resource{ + "host": resourceHost(), + }, + }, + } +} diff --git a/cancom/services/ipam/resource_host.go b/cancom/services/ipam/resource_host.go new file mode 100644 index 0000000..bc49520 --- /dev/null +++ b/cancom/services/ipam/resource_host.go @@ -0,0 +1,157 @@ +package ipam + +import ( + "context" + + "github.com/cancom/terraform-provider-cancom/client" + client_ipam "github.com/cancom/terraform-provider-cancom/client/services/ipam" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func resourceHost() *schema.Resource { + return &schema.Resource{ + CreateContext: resourceHostCreate, + ReadContext: resourceHostRead, + UpdateContext: resourceHostUpdate, + DeleteContext: resourceHostDelete, + Schema: map[string]*schema.Schema{ + "id": { + Type: schema.TypeString, + Computed: true, + }, + "network_crn": { + Type: schema.TypeString, + Computed: false, + Required: true, + }, + "qualifier": { + Type: schema.TypeString, + Computed: false, + Optional: true, + }, + "name_tag": { + Type: schema.TypeString, + Computed: false, + Required: true, + }, + "description": { + Type: schema.TypeString, + Computed: false, + Optional: true, + }, + "last_updated": { + Type: schema.TypeString, + Computed: true, + }, + "address": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +func resourceHostRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { + c := m.(*client.Client) + + c.HostURL = c.ServiceURLs["ip-management"] + var diags diag.Diagnostics + + id := d.Id() + + resp, err := (*client_ipam.Client)(c).GetHost(id) + + if err != nil { + return diag.FromErr(err) + } + + d.Set("name_tag", resp.NameTag) + d.Set("address", resp.Address) + d.Set("description", resp.Description) + d.Set("id", resp.ID) + + return diags +} + +func resourceHostCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { + c := m.(*client.Client) + + c.HostURL = c.ServiceURLs["ip-management"] + + var diags diag.Diagnostics + + host := &client_ipam.HostCreateRequest{ + NetworkCrn: d.Get("network_crn").(string), + NameTag: d.Get("name_tag").(string), + Operation: "assign_address", + Description: d.Get("description").(string), + Qualifier: d.Get("qualifier").(string), + Source: "CANCOM-TF", + } + + resp, err := (*client_ipam.Client)(c).CreateHost(host) + + if err != nil { + return diag.FromErr(err) + } + + id := resp.ID + + d.Set("address", resp.Address) + d.SetId(id) + + resourceHostRead(ctx, d, m) + + return diags + +} + +func resourceHostUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { + c := m.(*client.Client) + + c.HostURL = c.ServiceURLs["ip-management"] + + var diags diag.Diagnostics + + id := d.Id() + + host := &client_ipam.HostUpdateRequest{ + NetworkCrn: d.Get("network_crn").(string), + NameTag: d.Get("name_tag").(string), + Description: d.Get("description").(string), + Source: "CANCOM-TF", + } + + _, err := (*client_ipam.Client)(c).UpdateHost(id, host) + + if err != nil { + return diag.FromErr(err) + } + + d.SetId(id) + + resourceHostRead(ctx, d, m) + + return diags +} + +func resourceHostDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { + c := m.(*client.Client) + + c.HostURL = c.ServiceURLs["ip-management"] + + var diags diag.Diagnostics + + id := d.Id() + + err := (*client_ipam.Client)(c).DeleteHost(id) + + if err != nil { + return diag.FromErr(err) + } + + d.SetId("") + + return diags +} diff --git a/client/hosts.go b/client/hosts.go index 665aecd..d56764d 100644 --- a/client/hosts.go +++ b/client/hosts.go @@ -1,7 +1,9 @@ package client var ( - CustomerDBHostURL = "https://customer-db.portal.cancom.dev/v1" - ServiceRegistryURL = "https://service-registry.portal.cancom.dev/v1" - DnsURL = "https://vpswqliuu8.execute-api.eu-central-1.amazonaws.com/dev/v1" + CustomerDBHostURL = "https://customer-db.portal.cancom.dev/v1" + ServiceRegistryURL = "https://service-registry.portal.cancom.dev/v1" + DnsURL = "https://vpswqliuu8.execute-api.eu-central-1.amazonaws.com/dev/v1" + CmsMgwHostURL = "https://cmsmgw.cc-mase-interfaces.de/dev" + IpManagementHostURL = "https://ip-management.portal.cancom.io" ) diff --git a/client/services/cmsmgw/cmsmgw.go b/client/services/cmsmgw/cmsmgw.go new file mode 100644 index 0000000..c0a901f --- /dev/null +++ b/client/services/cmsmgw/cmsmgw.go @@ -0,0 +1,37 @@ +package client_cmsmgw + +import ( + "bytes" + "encoding/json" + "fmt" + "net/http" + + "github.com/cancom/terraform-provider-cancom/client" +) + +type Client client.Client + +func (c *Client) CreateGateway(record *GatewayCreateRequest) (*Gateway, error) { + body, err := json.Marshal(record) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", fmt.Sprintf("%s/Records", c.HostURL), bytes.NewBuffer(body)) + if err != nil { + return nil, err + } + + body, err = (*client.Client)(c).DoRequest(req) + if err != nil { + return nil, err + } + + recordBody := Gateway{} + err = json.Unmarshal(body, &recordBody) + if err != nil { + return nil, err + } + + return &recordBody, nil +} diff --git a/client/services/cmsmgw/models.go b/client/services/cmsmgw/models.go new file mode 100644 index 0000000..c463fce --- /dev/null +++ b/client/services/cmsmgw/models.go @@ -0,0 +1,10 @@ +package client_cmsmgw + +type Gateway struct { + ID string `json:"id"` + Name string `json:"name"` +} + +type GatewayCreateRequest struct { + Name string `json:"name"` +} diff --git a/client/services/ipam/ipam.go b/client/services/ipam/ipam.go new file mode 100644 index 0000000..4f90a30 --- /dev/null +++ b/client/services/ipam/ipam.go @@ -0,0 +1,113 @@ +package client_ipam + +import ( + //"bytes" + "encoding/json" + "fmt" + "math/rand" + "net/http" + "strings" + "time" + + "github.com/cancom/terraform-provider-cancom/client" +) + +type Client client.Client + +// GetHost - Returns a specifc host address +func (c *Client) GetHost(hostId string) (*Host, error) { + //return nil, errors.New(c.HostURL) + + req, err := http.NewRequest("GET", fmt.Sprintf("%s/v1/Hosts/%s", c.HostURL, hostId), nil) + if err != nil { + return nil, err + } + + body, err := (*client.Client)(c).DoRequest(req) + if err != nil { + return nil, err + } + + host := Host{} + err = json.Unmarshal(body, &host) + if err != nil { + return nil, err + } + + return &host, nil +} + +// CreateHost - Create new host +func (c *Client) CreateHost(host *HostCreateRequest) (*Host, error) { + rb, err := json.Marshal(host) + if err != nil { + return nil, err + } + // sleep for a random time to resolve race condition problem + rand.Seed(time.Now().UnixNano()) + n := rand.Intn(10) // n will be between 0 and 10 + time.Sleep(time.Duration(n) * time.Second) + + req, err := http.NewRequest("POST", fmt.Sprintf("%s/v1/Hosts", c.HostURL), strings.NewReader(string(rb))) + if err != nil { + return nil, err + } + + body, err := (*client.Client)(c).DoRequest(req) + if err != nil { + return nil, err + } + + newHost := Host{} + err = json.Unmarshal(body, &newHost) + if err != nil { + return nil, err + } + + return &newHost, nil +} + +// UpdateHost - Updates an Host +func (c *Client) UpdateHost(hostId string, host *HostUpdateRequest) (*Host, error) { + rb, err := json.Marshal(host) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("PUT", fmt.Sprintf("%s/v1/Hosts/%s", c.HostURL, hostId), strings.NewReader(string(rb))) + if err != nil { + return nil, err + } + + body, err := (*client.Client)(c).DoRequest(req) + if err != nil { + return nil, err + } + + newHost := Host{} + err = json.Unmarshal(body, &newHost) + if err != nil { + return nil, err + } + time.Sleep(4 * time.Second) + return &newHost, nil +} + +// DeleteHost - Release a host +func (c *Client) DeleteHost(hostId string) error { + req, err := http.NewRequest("DELETE", fmt.Sprintf("%s/v1/Hosts/%s", c.HostURL, hostId), nil) + if err != nil { + return err + } + + body, err := (*client.Client)(c).DoRequest(req) + if err != nil { + return err + } + + if string(body) != "Deleted host" { + return nil //errors.New(string(body)) + } + + return nil +} diff --git a/client/services/ipam/models.go b/client/services/ipam/models.go new file mode 100644 index 0000000..fa7dc44 --- /dev/null +++ b/client/services/ipam/models.go @@ -0,0 +1,43 @@ +package client_ipam + +type Gateway struct { + ID string `json:"id"` + Name string `json:"name"` +} + +type SupernetCreateRequest struct { + Name string `json:"name"` +} + +type Host struct { + ID string `json:"crn,omitempty"` + Operation string `json:"operation"` + Address string `json:"address"` + Qualifier string `json:"qualifier"` + NetworkCrn string `json:"networkCrn"` + NameTag string `json:"nameTag"` + Description string `json:"description"` + Source string `json:"source"` +} + +type HostCreateRequest struct { + ID string `json:"crn,omitempty"` + Operation string `json:"operation"` + Address string `json:"address"` + Qualifier string `json:"qualifier"` + NetworkCrn string `json:"networkCrn"` + NameTag string `json:"nameTag"` + Description string `json:"description"` + Source string `json:"source"` +} + +type HostUpdateRequest struct { + ID string `json:"crn,omitempty"` + Operation string `json:"operation"` + Address string `json:"address"` + Qualifier string `json:"qualifier"` + NetworkCrn string `json:"networkCrn"` + NameTag string `json:"nameTag"` + Description string `json:"description"` + Source string `json:"source"` +} diff --git a/docs/index.md b/docs/index.md index 0ffdeef..2430da7 100644 --- a/docs/index.md +++ b/docs/index.md @@ -56,4 +56,5 @@ $ terraform plan ### Optional +- `service_registry` (String) Service Registry to use for endpoint discovery - `token` (String) API Token retrieved from [https://portal.cancom.io](https://portal.cancom.io) diff --git a/docs/resources/cmsmgw_gateway.md.tmplx b/docs/resources/cmsmgw_gateway.md.tmplx new file mode 100644 index 0000000..de7e236 --- /dev/null +++ b/docs/resources/cmsmgw_gateway.md.tmplx @@ -0,0 +1,15 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "CANCOM: cmsmgw_gateway Resource" +subcategory: "" +description: |- + Represents a gateway resource +--- + +# cancom_cmsmgw_gateway (Resource) + +## Example Usage + +{{ tffile "examples/services/cmsmgw/resources/cmsmgw_gateway.tf" }} + +{{ .SchemaMarkdown | trimspace }} diff --git a/docs/resources/ipam_host.md b/docs/resources/ipam_host.md new file mode 100644 index 0000000..41f74f1 --- /dev/null +++ b/docs/resources/ipam_host.md @@ -0,0 +1,42 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "CANCOM: ipam_host Resource" +subcategory: "" +description: |- + IPAM host allowes you to assign host ip-addresses from a network that must be enabled for host assignment. The network is + identified by it´s id (crn). + You manage networks and enable them for host-assignments by using the portal or the network resource of this provider. +--- + +# cancom_ipam_supernet (Resource) + +## Example Usage + +```terraform +resource "cancom_ipam_host" "host" { + network_crn = "crn:KmBRNWt87RV26jJfZMeJus::ip-management:network:F4tfeFwx2i7HFjNrFop49z" + name_tag = "hostname.cancom.de" + qualifier = "" + description = "" +} +``` + + + +## Schema + +### Required + +- `name_tag` (String) +- `network_crn` (String) + +### Optional + +- `description` (String) +- `qualifier` (String) + +### Read-Only + +- `address` (String) +- `id` (String) The ID of this resource. +- `last_updated` (String) diff --git a/examples/services/cmsmgw/resources/cmsmgw_gateway.tf b/examples/services/cmsmgw/resources/cmsmgw_gateway.tf new file mode 100644 index 0000000..0a11296 --- /dev/null +++ b/examples/services/cmsmgw/resources/cmsmgw_gateway.tf @@ -0,0 +1,10 @@ + + +resource "cancom_cmsmgw_gateway" { + name = "Test" + size = "small" + + nat = true + bastion_linux = false + bastion_windows = false +} diff --git a/examples/services/ipam/resources/ipam_supernet.tf b/examples/services/ipam/resources/ipam_supernet.tf new file mode 100644 index 0000000..188703e --- /dev/null +++ b/examples/services/ipam/resources/ipam_supernet.tf @@ -0,0 +1,8 @@ + +resource "cancom_ipam_host" "host" { + network_crn = "crn:KmBRNWt87RV26jJfZMeJus::ip-management:network:F4tfeFwx2i7HFjNrFop49z" + name_tag = "hostname.cancom.de" + qualifier = "" + description = "" +} + diff --git a/go.mod b/go.mod index 7078cde..ef83887 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,10 @@ module github.com/cancom/terraform-provider-cancom go 1.18 -require github.com/hashicorp/terraform-plugin-sdk/v2 v2.18.0 +require ( + github.com/hashicorp/terraform-plugin-docs v0.13.0 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.18.0 +) require ( github.com/Masterminds/goutils v1.1.1 // indirect @@ -30,7 +33,6 @@ require ( github.com/hashicorp/logutils v1.0.0 // indirect github.com/hashicorp/terraform-exec v0.17.2 // indirect github.com/hashicorp/terraform-json v0.14.0 // indirect - github.com/hashicorp/terraform-plugin-docs v0.13.0 // indirect github.com/hashicorp/terraform-plugin-go v0.10.0 // indirect github.com/hashicorp/terraform-plugin-log v0.4.1 // indirect github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect diff --git a/go.sum b/go.sum index eb5425a..82f585e 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,11 @@ github.com/Masterminds/sprig/v3 v3.2.0/go.mod h1:tWhwTbUTndesPNeF0C900vKoq283u6z github.com/Masterminds/sprig/v3 v3.2.2 h1:17jRggJu518dr3QaafizSXOjKYp94wKfABxUmyxvxX8= github.com/Masterminds/sprig/v3 v3.2.2/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk= github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0= +github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C67SkzkDfmQuVln04ygHj3vjZfd9FL+GmQQ= github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo= +github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= github.com/acomagu/bufpipe v1.0.3/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4= github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE= github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= @@ -41,6 +44,7 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -52,12 +56,16 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= +github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4= github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E= github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= +github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34= github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0= github.com/go-git/go-git-fixtures/v4 v4.2.1/go.mod h1:K8zd3kDUAykwTdDCr+I0per6Y6vMiRR/nnVTBtavnB0= +github.com/go-git/go-git/v5 v5.4.2 h1:BXyZu9t0VkbiHtqrsvdq39UDhGJTl1h55VW6CSC4aY4= github.com/go-git/go-git/v5 v5.4.2/go.mod h1:gQ1kArt6d+n+BGd+/B/I74HwRTLhth2+zti4ihgckDc= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -93,7 +101,6 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -150,17 +157,19 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4= github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= +github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck= github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -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/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= 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/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= @@ -178,6 +187,7 @@ github.com/mitchellh/cli v1.1.4/go.mod h1:vTLESy5mRhKOs9KDp0/RATawxP1UqBmdrpVRMn github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= @@ -201,10 +211,12 @@ github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXq github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= +github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= @@ -229,6 +241,7 @@ github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvC 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/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI= github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0= github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= @@ -293,7 +306,6 @@ golang.org/x/sys v0.0.0-20210502180810-71e4cd670f79/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b h1:2n253B2r0pYSmEV+UNCQoPfU/FiaizQEK5Gu4Bq4JE8= golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -346,11 +358,12 @@ google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -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= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/templates/resources/cmsmgw_gateway.md.tmpl b/templates/resources/cmsmgw_gateway.md.tmpl new file mode 100644 index 0000000..535601f --- /dev/null +++ b/templates/resources/cmsmgw_gateway.md.tmpl @@ -0,0 +1,16 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "CANCOM: cmsmgw_gateway Resource" +subcategory: "" +description: |- + Represents a gateway resource +--- + +# cancom_cmsmgw_gateway (Resource) + +## Example Usage + +{{ tffile "examples/services/cmsmgw/resources/cmsmgw_gateway.tf" }} + + +{{ .SchemaMarkdown | trimspace }} diff --git a/templates/resources/ipam_host.md.tmpl b/templates/resources/ipam_host.md.tmpl new file mode 100644 index 0000000..ac84599 --- /dev/null +++ b/templates/resources/ipam_host.md.tmpl @@ -0,0 +1,18 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "CANCOM: ipam_host Resource" +subcategory: "" +description: |- + IPAM host allowes you to assign host ip-addresses from a network that must be enabled for host assignment. The network is + identified by it´s id (crn). + You manage networks and enable them for host-assignments by using the portal or the network resource of this provider. +--- + +# cancom_ipam_supernet (Resource) + +## Example Usage + +{{ tffile "examples/services/ipam/resources/ipam_supernet.tf" }} + + +{{ .SchemaMarkdown | trimspace }}