Compare commits
No commits in common. 'main' and '4.7.2' have entirely different histories.
@ -0,0 +1,168 @@
|
|||||||
|
# terraform-provider-decort
|
||||||
|
|
||||||
|
Terraform provider for Digital Energy Cloud Orchestration Technology (DECORT) platform
|
||||||
|
|
||||||
|
## Mapping of platform versions with provider versions
|
||||||
|
|
||||||
|
| DECORT API version | Terraform provider version |
|
||||||
|
| ------ | ------ |
|
||||||
|
| 3.8.5 | 3.4.x |
|
||||||
|
| 3.8.0 - 3.8.4 | 3.3.1 |
|
||||||
|
| 3.7.x | rc-1.25 |
|
||||||
|
| 3.6.x | rc-1.10 |
|
||||||
|
| до 3.6.0 | [terraform-provider-decs](https://github.com/rudecs/terraform-provider-decs) |
|
||||||
|
|
||||||
|
## Working modes
|
||||||
|
|
||||||
|
The provider support two working modes:
|
||||||
|
|
||||||
|
- User mode,
|
||||||
|
- Administator mode.
|
||||||
|
Use flag DECORT_ADMIN_MODE for swithcing beetwen modes.
|
||||||
|
See user guide at https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Work with Compute instances,
|
||||||
|
- Work with disks,
|
||||||
|
- Work with k8s,
|
||||||
|
- Work with image,
|
||||||
|
- Work with reource groups,
|
||||||
|
- Work with VINS,
|
||||||
|
- Work with pfw,
|
||||||
|
- Work with accounts,
|
||||||
|
- Work with snapshots,
|
||||||
|
- Work with pcidevice.
|
||||||
|
- Work with sep,
|
||||||
|
- Work with vgpu,
|
||||||
|
- Work with bservice,
|
||||||
|
- Work with extnets,
|
||||||
|
- Work with locations,
|
||||||
|
- Work with load balancers.
|
||||||
|
|
||||||
|
This provider supports Import operations on pre-existing resources.
|
||||||
|
|
||||||
|
See user guide at https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
|
||||||
|
## Get Started
|
||||||
|
|
||||||
|
Two ways for starting:
|
||||||
|
|
||||||
|
1. Installing via binary packages
|
||||||
|
2. Manual installing
|
||||||
|
|
||||||
|
### Installing via binary packages
|
||||||
|
|
||||||
|
1. Download and install terraform: https://learn.hashicorp.com/tutorials/terraform/install-cli?in=terraform/aws-get-started
|
||||||
|
2. Create a file `main.tf` and add to it next section.
|
||||||
|
|
||||||
|
```terraform
|
||||||
|
provider "decort" {
|
||||||
|
authenticator = "decs3o"
|
||||||
|
#controller_url = <DECORT_CONTROLLER_URL>
|
||||||
|
controller_url = "https://ds1.digitalenergy.online"
|
||||||
|
#oauth2_url = <DECORT_SSO_URL>
|
||||||
|
oauth2_url = "https://sso.digitalenergy.online"
|
||||||
|
allow_unverified_ssl = true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Execute next command
|
||||||
|
|
||||||
|
```
|
||||||
|
terraform init
|
||||||
|
```
|
||||||
|
|
||||||
|
The Provider will automatically install on your computer from the terrafrom registry.
|
||||||
|
|
||||||
|
### Manual installing
|
||||||
|
|
||||||
|
1. Download and install Go Programming Language: https://go.dev/dl/
|
||||||
|
2. Download and install terraform: https://learn.hashicorp.com/tutorials/terraform/install-cli?in=terraform/aws-get-started
|
||||||
|
3. Clone provider's repo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/rudecs/terraform-provider-decort.git
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Change directory to clone provider's and execute next command
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go build -o terraform-provider-decort
|
||||||
|
```
|
||||||
|
|
||||||
|
If you have experience with _makefile_, you can change `Makefile`'s paramters and execute next command
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make build
|
||||||
|
```
|
||||||
|
|
||||||
|
5. Now move compilled file to:
|
||||||
|
Linux:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/.terraform.d/plugins/${host_name}/${namespace}/${type}/${version}/${target}
|
||||||
|
```
|
||||||
|
|
||||||
|
Windows:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
%APPDATA%\terraform.d\plugins\${host_name}/${namespace}/${type}/${version}/${target}
|
||||||
|
```
|
||||||
|
|
||||||
|
NOTE: for Windows OS `%APP_DATA%` is a cataloge, where will place terraform files.
|
||||||
|
Example:
|
||||||
|
|
||||||
|
- host_name - digitalenergy.online
|
||||||
|
- namespace - decort
|
||||||
|
- type - decort
|
||||||
|
- version - 1.2
|
||||||
|
- target - windows_amd64
|
||||||
|
|
||||||
|
6. After all, create a file `main.tf`.
|
||||||
|
7. Add to the file next code section
|
||||||
|
|
||||||
|
```terraform
|
||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
decort = {
|
||||||
|
version = "1.2"
|
||||||
|
source = "digitalenergy.online/decort/decort"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`version`- field for provider's version
|
||||||
|
Required
|
||||||
|
String
|
||||||
|
Note: Versions in code section and in a repository must be equal!
|
||||||
|
|
||||||
|
`source` - path to repository with provider's version
|
||||||
|
|
||||||
|
```bash
|
||||||
|
${host_name}/${namespace}/${type}
|
||||||
|
```
|
||||||
|
|
||||||
|
NOTE: all paramters must be equal to the repository path!
|
||||||
|
|
||||||
|
8. Execute command in your terminal
|
||||||
|
|
||||||
|
```bash
|
||||||
|
terraform init
|
||||||
|
```
|
||||||
|
|
||||||
|
9. If everything all right - you got green message in your terminal!
|
||||||
|
|
||||||
|
More details about the provider's building process: https://learn.hashicorp.com/tutorials/terraform/provider-use?in=terraform/providers
|
||||||
|
|
||||||
|
## Examples and Samples
|
||||||
|
|
||||||
|
- Examples: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
||||||
|
- Samples: see in repository `samples`
|
||||||
|
|
||||||
|
Terraform schemas in:
|
||||||
|
|
||||||
|
- See in repository `docs`
|
||||||
|
|
||||||
|
Good work!
|
Binary file not shown.
@ -1,61 +0,0 @@
|
|||||||
---
|
|
||||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
|
||||||
page_title: "decort_cb_extnet_reserved_ip_list Data Source - terraform-provider-decort"
|
|
||||||
subcategory: ""
|
|
||||||
description: |-
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# decort_cb_extnet_reserved_ip_list (Data Source)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
|
||||||
## Schema
|
|
||||||
|
|
||||||
### Required
|
|
||||||
|
|
||||||
- `account_id` (Number)
|
|
||||||
|
|
||||||
### Optional
|
|
||||||
|
|
||||||
- `extnet_id` (Number)
|
|
||||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
|
||||||
|
|
||||||
### Read-Only
|
|
||||||
|
|
||||||
- `id` (String) The ID of this resource.
|
|
||||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
|
||||||
|
|
||||||
<a id="nestedblock--timeouts"></a>
|
|
||||||
### Nested Schema for `timeouts`
|
|
||||||
|
|
||||||
Optional:
|
|
||||||
|
|
||||||
- `default` (String)
|
|
||||||
- `read` (String)
|
|
||||||
|
|
||||||
|
|
||||||
<a id="nestedatt--items"></a>
|
|
||||||
### Nested Schema for `items`
|
|
||||||
|
|
||||||
Read-Only:
|
|
||||||
|
|
||||||
- `extnet_id` (Number)
|
|
||||||
- `reservations` (List of Object) (see [below for nested schema](#nestedobjatt--items--reservations))
|
|
||||||
|
|
||||||
<a id="nestedobjatt--items--reservations"></a>
|
|
||||||
### Nested Schema for `items.reservations`
|
|
||||||
|
|
||||||
Read-Only:
|
|
||||||
|
|
||||||
- `account_id` (Number)
|
|
||||||
- `client_type` (String)
|
|
||||||
- `domain_name` (String)
|
|
||||||
- `hostname` (String)
|
|
||||||
- `ip` (String)
|
|
||||||
- `mac` (String)
|
|
||||||
- `type` (String)
|
|
||||||
- `vm_id` (Number)
|
|
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
||||||
|
page_title: "decort_cb_grid_post_diagnosis Data Source - terraform-provider-decort"
|
||||||
|
subcategory: ""
|
||||||
|
description: |-
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# decort_cb_grid_post_diagnosis (Data Source)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- schema generated by tfplugindocs -->
|
||||||
|
## Schema
|
||||||
|
|
||||||
|
### Required
|
||||||
|
|
||||||
|
- `gid` (Number)
|
||||||
|
|
||||||
|
### Optional
|
||||||
|
|
||||||
|
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
||||||
|
|
||||||
|
### Read-Only
|
||||||
|
|
||||||
|
- `diagnosis` (String)
|
||||||
|
- `id` (String) The ID of this resource.
|
||||||
|
|
||||||
|
<a id="nestedblock--timeouts"></a>
|
||||||
|
### Nested Schema for `timeouts`
|
||||||
|
|
||||||
|
Optional:
|
||||||
|
|
||||||
|
- `default` (String)
|
||||||
|
- `read` (String)
|
@ -1,61 +0,0 @@
|
|||||||
---
|
|
||||||
# generated by https://github.com/hashicorp/terraform-plugin-docs
|
|
||||||
page_title: "decort_extnet_reserved_ip_list Data Source - terraform-provider-decort"
|
|
||||||
subcategory: ""
|
|
||||||
description: |-
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# decort_extnet_reserved_ip_list (Data Source)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- schema generated by tfplugindocs -->
|
|
||||||
## Schema
|
|
||||||
|
|
||||||
### Required
|
|
||||||
|
|
||||||
- `account_id` (Number)
|
|
||||||
|
|
||||||
### Optional
|
|
||||||
|
|
||||||
- `extnet_id` (Number)
|
|
||||||
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
|
|
||||||
|
|
||||||
### Read-Only
|
|
||||||
|
|
||||||
- `id` (String) The ID of this resource.
|
|
||||||
- `items` (List of Object) (see [below for nested schema](#nestedatt--items))
|
|
||||||
|
|
||||||
<a id="nestedblock--timeouts"></a>
|
|
||||||
### Nested Schema for `timeouts`
|
|
||||||
|
|
||||||
Optional:
|
|
||||||
|
|
||||||
- `default` (String)
|
|
||||||
- `read` (String)
|
|
||||||
|
|
||||||
|
|
||||||
<a id="nestedatt--items"></a>
|
|
||||||
### Nested Schema for `items`
|
|
||||||
|
|
||||||
Read-Only:
|
|
||||||
|
|
||||||
- `extnet_id` (Number)
|
|
||||||
- `reservations` (List of Object) (see [below for nested schema](#nestedobjatt--items--reservations))
|
|
||||||
|
|
||||||
<a id="nestedobjatt--items--reservations"></a>
|
|
||||||
### Nested Schema for `items.reservations`
|
|
||||||
|
|
||||||
Read-Only:
|
|
||||||
|
|
||||||
- `account_id` (Number)
|
|
||||||
- `client_type` (String)
|
|
||||||
- `domain_name` (String)
|
|
||||||
- `hostname` (String)
|
|
||||||
- `ip` (String)
|
|
||||||
- `mac` (String)
|
|
||||||
- `type` (String)
|
|
||||||
- `vm_id` (Number)
|
|
@ -1,137 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
|
||||||
Tim Tkachev, <tvtkachev@basistech.ru>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package extnet
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
|
||||||
)
|
|
||||||
|
|
||||||
func dataSourceExtnetReservedIpRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
|
||||||
reservedList, err := utilityExtnetReservedIpCheckPresence(ctx, d, m)
|
|
||||||
if err != nil {
|
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
|
||||||
d.Set("items", flattenExtnetReservedIp(reservedList))
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func dataSourceExtnetReservedIpSchemaMake() map[string]*schema.Schema {
|
|
||||||
res := map[string]*schema.Schema{
|
|
||||||
"account_id": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Required: true,
|
|
||||||
},
|
|
||||||
"extnet_id": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Optional: true,
|
|
||||||
},
|
|
||||||
"items": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Resource{
|
|
||||||
Schema: map[string]*schema.Schema{
|
|
||||||
"extnet_id": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"reservations": {
|
|
||||||
Type: schema.TypeList,
|
|
||||||
Computed: true,
|
|
||||||
Elem: &schema.Resource{
|
|
||||||
Schema: map[string]*schema.Schema{
|
|
||||||
"account_id": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"client_type": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"domain_name": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"hostname": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"ip": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"mac": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"type": {
|
|
||||||
Type: schema.TypeString,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
"vm_id": {
|
|
||||||
Type: schema.TypeInt,
|
|
||||||
Computed: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
func DataSourceExtnetReservedIp() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
|
||||||
SchemaVersion: 1,
|
|
||||||
|
|
||||||
ReadContext: dataSourceExtnetReservedIpRead,
|
|
||||||
|
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
|
||||||
Default: &constants.Timeout60s,
|
|
||||||
},
|
|
||||||
|
|
||||||
Schema: dataSourceExtnetReservedIpSchemaMake(),
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package extnet
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudapi/extnet"
|
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
|
||||||
)
|
|
||||||
|
|
||||||
func utilityExtnetReservedIpCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) ([]extnet.RecordReservedIP, error) {
|
|
||||||
c := m.(*controller.ControllerCfg)
|
|
||||||
req := extnet.GetReservedIP{
|
|
||||||
AccountID: uint64(d.Get("account_id").(int)),
|
|
||||||
}
|
|
||||||
|
|
||||||
if extNetID, ok := d.GetOk("extnet_id"); ok {
|
|
||||||
req.ExtNetID = uint64(extNetID.(int))
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Debugf("utilityExtnetReservedIpCheckPresence")
|
|
||||||
res, err := c.CloudAPI().ExtNet().GetReservedIP(ctx, req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
|
||||||
Tim Tkachev, <tvtkachev@basistech.ru>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package extnet
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/constants"
|
|
||||||
)
|
|
||||||
|
|
||||||
func dataSourceExtnetReservedIpRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
|
|
||||||
reservedList, err := utilityExtnetReservedIpCheckPresence(ctx, d, m)
|
|
||||||
if err != nil {
|
|
||||||
return diag.FromErr(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
id := uuid.New()
|
|
||||||
d.SetId(id.String())
|
|
||||||
d.Set("items", flattenExtnetReservedIp(reservedList))
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func DataSourceExtnetReservedIp() *schema.Resource {
|
|
||||||
return &schema.Resource{
|
|
||||||
SchemaVersion: 1,
|
|
||||||
|
|
||||||
ReadContext: dataSourceExtnetReservedIpRead,
|
|
||||||
|
|
||||||
Timeouts: &schema.ResourceTimeout{
|
|
||||||
Read: &constants.Timeout30s,
|
|
||||||
Default: &constants.Timeout60s,
|
|
||||||
},
|
|
||||||
|
|
||||||
Schema: dataSourceExtnetReservedIpSchemaMake(),
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2019-2022 Digital Energy Cloud Solutions LLC. All Rights Reserved.
|
|
||||||
Authors:
|
|
||||||
Petr Krutov, <petr.krutov@digitalenergy.online>
|
|
||||||
Stanislav Solovev, <spsolovev@digitalenergy.online>
|
|
||||||
Kasim Baybikov, <kmbaybikov@basistech.ru>
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Terraform DECORT provider - manage resources provided by DECORT (Digital Energy Cloud
|
|
||||||
Orchestration Technology) with Terraform by Hashicorp.
|
|
||||||
|
|
||||||
Source code: https://repository.basistech.ru/BASIS/terraform-provider-decort
|
|
||||||
|
|
||||||
Please see README.md to learn where to place source code so that it
|
|
||||||
builds seamlessly.
|
|
||||||
|
|
||||||
Documentation: https://repository.basistech.ru/BASIS/terraform-provider-decort/wiki
|
|
||||||
*/
|
|
||||||
|
|
||||||
package extnet
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"repository.basistech.ru/BASIS/decort-golang-sdk/pkg/cloudbroker/extnet"
|
|
||||||
"repository.basistech.ru/BASIS/terraform-provider-decort/internal/controller"
|
|
||||||
)
|
|
||||||
|
|
||||||
func utilityExtnetReservedIpCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) ([]extnet.RecordReservedIP, error) {
|
|
||||||
c := m.(*controller.ControllerCfg)
|
|
||||||
req := extnet.GetReservedIP{
|
|
||||||
AccountID: uint64(d.Get("account_id").(int)),
|
|
||||||
}
|
|
||||||
|
|
||||||
if extNetID, ok := d.GetOk("extnet_id"); ok {
|
|
||||||
req.ExtNetID = uint64(extNetID.(int))
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Debugf("utilityExtnetReservedIpCheckPresence")
|
|
||||||
res, err := c.CloudBroker().ExtNet().GetReservedIP(ctx, req)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return res, nil
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
Данный раздел описывает:
|
|
||||||
- Системные требования
|
|
||||||
- Установку провайдера
|
|
||||||
- Инициализацию провайдера
|
|
||||||
- Переключение режима работы между разными группами API
|
|
||||||
- Получение gid/grid_id площадки
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue