diff --git a/docs/data-sources/gcore_reservedfixedip.md b/docs/data-sources/gcore_reservedfixedip.md index d86acba..57f795d 100644 --- a/docs/data-sources/gcore_reservedfixedip.md +++ b/docs/data-sources/gcore_reservedfixedip.md @@ -59,6 +59,7 @@ output "view" { - **allowed_address_pairs** (List of Object) (see [below for nested schema](#nestedatt--allowed_address_pairs)) - **is_vip** (Boolean) - **network_id** (String) +- **port_id** (String) ID of the port_id underlying the reserved fixed IP - **status** (String) - **subnet_id** (String) diff --git a/docs/resources/gcore_reservedfixedip.md b/docs/resources/gcore_reservedfixedip.md index 1458bdc..a020059 100644 --- a/docs/resources/gcore_reservedfixedip.md +++ b/docs/resources/gcore_reservedfixedip.md @@ -50,7 +50,8 @@ resource "gcore_reservedfixedip" "fixed_ip" { ### Read-Only -- **allowed_address_pairs** (List of Object) (see [below for nested schema](#nestedatt--allowed_address_pairs)) +- **allowed_address_pairs** (List of Object) Group of IP addresses that share the current IP as VIP (see [below for nested schema](#nestedatt--allowed_address_pairs)) +- **port_id** (String) ID of the port_id underlying the reserved fixed IP - **status** (String) diff --git a/docs/resources/gcore_router.md b/docs/resources/gcore_router.md index cfbb5ba..4087479 100644 --- a/docs/resources/gcore_router.md +++ b/docs/resources/gcore_router.md @@ -80,12 +80,12 @@ resource "gcore_router" "router" { Required: -- **enable_snat** (Boolean) -- **type** (String) Must be 'manual' +- **network_id** (String) Id of the external network Optional: -- **network_id** (String) +- **enable_snat** (Boolean) +- **type** (String) Must be 'manual' Read-Only: @@ -106,7 +106,7 @@ Read-Only: Required: -- **subnet_id** (String) +- **subnet_id** (String) Subnet for router interface must have a gateway IP - **type** (String) must be 'subnet' diff --git a/examples/resources/gcore_router/vars.tf b/examples/resources/gcore_router/vars.tf index d0675f0..f8bfabb 100755 --- a/examples/resources/gcore_router/vars.tf +++ b/examples/resources/gcore_router/vars.tf @@ -6,9 +6,9 @@ variable "external_gateway_info" { })) default = [ { - type = "default" + type = "manual" enable_snat = false - network_id = "" + network_id = "" //set external network id }, ] } diff --git a/gcore/data_source_gcore_reservedfixedip.go b/gcore/data_source_gcore_reservedfixedip.go index b177e20..085bf30 100644 --- a/gcore/data_source_gcore_reservedfixedip.go +++ b/gcore/data_source_gcore_reservedfixedip.go @@ -78,6 +78,11 @@ func dataSourceReservedFixedIP() *schema.Resource { Type: schema.TypeBool, Computed: true, }, + "port_id": &schema.Schema{ + Type: schema.TypeString, + Description: "ID of the port_id underlying the reserved fixed IP", + Computed: true, + }, "allowed_address_pairs": { Type: schema.TypeList, Computed: true, @@ -138,6 +143,7 @@ func dataSourceReservedFixedIPRead(ctx context.Context, d *schema.ResourceData, d.Set("subnet_id", reservedFixedIP.SubnetID) d.Set("network_id", reservedFixedIP.NetworkID) d.Set("is_vip", reservedFixedIP.IsVip) + d.Set("port_id", reservedFixedIP.PortID) allowedPairs := make([]map[string]interface{}, len(reservedFixedIP.AllowedAddressPairs)) for i, p := range reservedFixedIP.AllowedAddressPairs { diff --git a/gcore/resource_gcore_reservedfixedip.go b/gcore/resource_gcore_reservedfixedip.go index 8dcda61..c2cf98f 100644 --- a/gcore/resource_gcore_reservedfixedip.go +++ b/gcore/resource_gcore_reservedfixedip.go @@ -113,9 +113,15 @@ func resourceReservedFixedIP() *schema.Resource { Type: schema.TypeBool, Required: true, }, + "port_id": &schema.Schema{ + Type: schema.TypeString, + Description: "ID of the port_id underlying the reserved fixed IP", + Computed: true, + }, "allowed_address_pairs": { - Type: schema.TypeList, - Computed: true, + Type: schema.TypeList, + Computed: true, + Description: "Group of IP addresses that share the current IP as VIP", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "ip_address": { @@ -236,6 +242,7 @@ func resourceReservedFixedIPRead(ctx context.Context, d *schema.ResourceData, m d.Set("subnet_id", reservedFixedIP.SubnetID) d.Set("network_id", reservedFixedIP.NetworkID) d.Set("is_vip", reservedFixedIP.IsVip) + d.Set("port_id", reservedFixedIP.PortID) allowedPairs := make([]map[string]interface{}, len(reservedFixedIP.AllowedAddressPairs)) for i, p := range reservedFixedIP.AllowedAddressPairs { diff --git a/gcore/resource_gcore_router.go b/gcore/resource_gcore_router.go index 554a750..8d256db 100644 --- a/gcore/resource_gcore_router.go +++ b/gcore/resource_gcore_router.go @@ -80,23 +80,26 @@ func resourceRouter() *schema.Resource { "external_gateway_info": { Type: schema.TypeList, Optional: true, + Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "type": { Type: schema.TypeString, Description: "Must be 'manual'", - Required: true, + Optional: true, + Computed: true, }, "enable_snat": { Type: schema.TypeBool, - Required: true, - }, - "network_id": { - Type: schema.TypeString, Optional: true, Computed: true, }, + "network_id": { + Type: schema.TypeString, + Description: "Id of the external network", + Required: true, + }, "external_fixed_ips": { Type: schema.TypeList, Computed: true, @@ -127,8 +130,9 @@ func resourceRouter() *schema.Resource { Required: true, }, "subnet_id": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Description: "Subnet for router interface must have a gateway IP", + Required: true, }, }, }, diff --git a/go.mod b/go.mod index 12e96e8..36614ed 100644 --- a/go.mod +++ b/go.mod @@ -8,6 +8,7 @@ require ( github.com/G-Core/gcorelabscloud-go v0.4.15 github.com/google/uuid v1.1.2 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 + github.com/hashicorp/terraform-plugin-docs v0.4.0 // indirect github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.3 github.com/imdario/mergo v0.3.11 // indirect github.com/mattn/go-colorable v0.1.8 // indirect diff --git a/go.sum b/go.sum index b395e0f..b399448 100644 --- a/go.sum +++ b/go.sum @@ -47,6 +47,12 @@ github.com/G-Core/gcorelabscdn-go v0.0.0-20210503173228-b4ac8b2402ff h1:kIH66Shw github.com/G-Core/gcorelabscdn-go v0.0.0-20210503173228-b4ac8b2402ff/go.mod h1:iSGXaTvZBzDHQW+rKFS918BgFVpONcyLEijwh8WsXpE= github.com/G-Core/gcorelabscloud-go v0.4.15 h1:cu1GUGiUaGQlljlxRACqNvr6eKx2MCyEXyB8zEVcH50= github.com/G-Core/gcorelabscloud-go v0.4.15/go.mod h1:Z1MF80mWagEUrxygtYkvW/MJEYNmIUPsIEYBB3cKjOM= +github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg= +github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww= +github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= +github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60= +github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -72,6 +78,7 @@ github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2 github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= github.com/apparentlymart/go-textseg/v12 v12.0.0 h1:bNEQyAGak9tojivJNkoqWErVCQbjdL7GzRt3F8NvfJ0= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= +github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 h1:BUAU3CGlLvorLI26FmByPp2eC2qla6E1Tw+scpcg/to= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= @@ -87,6 +94,7 @@ github.com/aws/aws-sdk-go v1.34.28 h1:sscPpn/Ns3i0F4HPEWAVcwdIRaZZCuL7llJ2/60yPI github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= +github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= @@ -368,10 +376,13 @@ github.com/hashicorp/hcl/v2 v2.3.0 h1:iRly8YaMwTBAKhn1Ybk7VSdzbnopghktCD031P8ggU github.com/hashicorp/hcl/v2 v2.3.0/go.mod h1:d+FwDBbOLvpAM3Z6J7gPj/VoAGkNe/gm352ZhjJ/Zv8= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= +github.com/hashicorp/terraform-exec v0.12.0/go.mod h1:SGhto91bVRlgXQWcJ5znSz+29UZIa8kpBbkGwQ+g9E8= github.com/hashicorp/terraform-exec v0.13.0 h1:1Pth+pdWJAufJuWWjaVOVNEkoRTOjGn3hQpAqj4aPdg= github.com/hashicorp/terraform-exec v0.13.0/go.mod h1:SGhto91bVRlgXQWcJ5znSz+29UZIa8kpBbkGwQ+g9E8= github.com/hashicorp/terraform-json v0.8.0 h1:XObQ3PgqU52YLQKEaJ08QtUshAfN3yu4u8ebSW0vztc= github.com/hashicorp/terraform-json v0.8.0/go.mod h1:3defM4kkMfttwiE7VakJDwCd4R+umhSQnvJwORXbprE= +github.com/hashicorp/terraform-plugin-docs v0.4.0 h1:xJIXsMzBFwBvC1zcjoNz743GL2tNEfYFFU9+Hjp4Uek= +github.com/hashicorp/terraform-plugin-docs v0.4.0/go.mod h1:fKj/V3t45tiXpSlUms/0G4OrBayyWpbUJ4WtLjBkINU= github.com/hashicorp/terraform-plugin-go v0.2.1 h1:EW/R8bB2Zbkjmugzsy1d27yS8/0454b3MtYHkzOknqA= github.com/hashicorp/terraform-plugin-go v0.2.1/go.mod h1:10V6F3taeDWVAoLlkmArKttR3IULlRWFAGtQIQTIDr4= github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.3 h1:DGnxpIYRHXQZb2TOlQ1OCEYxoRQrAcbLIcYm8kvbFuU= @@ -380,6 +391,8 @@ github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKe github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw= +github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/iancoleman/strcase v0.0.0-20191112232945-16388991a334/go.mod h1:SK73tn/9oHe+/Y0h39VT4UCxmurVJkR5NA7kMEAOgSE= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -458,6 +471,8 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mitchellh/cli v1.1.1/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= +github.com/mitchellh/cli v1.1.2 h1:PvH+lL2B7IQ101xQL63Of8yFS2y+aDlsFcsqNc+u/Kw= +github.com/mitchellh/cli v1.1.2/go.mod h1:6iaV0fGdElS6dPBx0EApTxHrcWvmJphyh2n8YBLPPZ4= github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -513,11 +528,14 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.1.1 h1:ccV59UEOTzVDnDUEFdT95ZzHVZ+5+158q8+SJb2QV5w= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= +github.com/russross/blackfriday v1.6.0/go.mod h1:ti0ldHuxg49ri4ksnFxlkCfN+hvslNlmVHqNRXXJNAY= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=