Skip to content

Commit d34ab2b

Browse files
committed
Added instance shared core changes
1 parent cd64978 commit d34ab2b

19 files changed

+859
-133
lines changed

common/github.com/IBM/vpc-go-sdk/go.mod

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
module github.com/IBM/vpc-go-sdk
22

3-
go 1.21
3+
go 1.23.0
44

5-
toolchain go1.22.2
5+
toolchain go1.23.11
66

77
require (
88
github.com/IBM/go-sdk-core/v5 v5.20.1
9-
github.com/go-openapi/strfmt v0.22.1
9+
github.com/go-openapi/strfmt v0.23.0
1010
github.com/google/uuid v1.6.0
11-
github.com/stretchr/testify v1.8.4
11+
github.com/stretchr/testify v1.10.0
1212
)
1313

1414
require (
1515
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
1616
github.com/davecgh/go-spew v1.1.1 // indirect
17-
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
18-
github.com/go-openapi/errors v0.21.0 // indirect
17+
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
18+
github.com/go-openapi/errors v0.22.0 // indirect
1919
github.com/go-playground/locales v0.14.1 // indirect
2020
github.com/go-playground/universal-translator v0.18.1 // indirect
21-
github.com/go-playground/validator/v10 v10.19.0 // indirect
21+
github.com/go-playground/validator/v10 v10.26.0 // indirect
2222
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
2323
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
2424
github.com/leodido/go-urn v1.4.0 // indirect
2525
github.com/mitchellh/mapstructure v1.5.0 // indirect
2626
github.com/oklog/ulid v1.3.1 // indirect
2727
github.com/pmezard/go-difflib v1.0.0 // indirect
28-
go.mongodb.org/mongo-driver v1.14.0 // indirect
29-
golang.org/x/crypto v0.21.0 // indirect
30-
golang.org/x/net v0.23.0 // indirect
31-
golang.org/x/sys v0.20.0 // indirect
32-
golang.org/x/text v0.14.0 // indirect
33-
gopkg.in/yaml.v2 v2.4.0 // indirect
28+
go.mongodb.org/mongo-driver v1.17.2 // indirect
29+
golang.org/x/crypto v0.36.0 // indirect
30+
golang.org/x/net v0.38.0 // indirect
31+
golang.org/x/sys v0.31.0 // indirect
32+
golang.org/x/text v0.23.0 // indirect
3433
gopkg.in/yaml.v3 v3.0.1 // indirect
34+
sigs.k8s.io/yaml v1.4.0 // indirect
3535
)
3636

3737
retract (
Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
github.com/IBM/go-sdk-core/v5 v5.18.1 h1:wdftQO8xejECTWTKF3FGXyW0McKxxDAopH7MKwA187c=
2-
github.com/IBM/go-sdk-core/v5 v5.18.1/go.mod h1:3ywpylZ41WhWPusqtpJZWopYlt2brebcphV7mA2JncU=
1+
github.com/IBM/go-sdk-core/v5 v5.20.1 h1:dzeyifh1kfRLw8VfAIIS5okZYuqLTqplPZP/Kcsgdlo=
2+
github.com/IBM/go-sdk-core/v5 v5.20.1/go.mod h1:Q3BYO6iDA2zweQPDGbNTtqft5tDcEpm6RTuqMlPcvbw=
33
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
44
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
55
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
@@ -8,22 +8,23 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
88
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
99
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
1010
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
11-
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
12-
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
13-
github.com/go-openapi/errors v0.21.0 h1:FhChC/duCnfoLj1gZ0BgaBmzhJC2SL/sJr8a2vAobSY=
14-
github.com/go-openapi/errors v0.21.0/go.mod h1:jxNTMUxRCKj65yb/okJGEtahVd7uvWnuWfj53bse4ho=
15-
github.com/go-openapi/strfmt v0.22.1 h1:5Ky8cybT4576C6Ffc+8gYji/wRXCo6Ozm8RaWjPI6jc=
16-
github.com/go-openapi/strfmt v0.22.1/go.mod h1:OfVoytIXJasDkkGvkb1Cceb3BPyMOwk1FgmyyEw7NYg=
11+
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
12+
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
13+
github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w=
14+
github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE=
15+
github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c=
16+
github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4=
1717
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
1818
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
1919
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
2020
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
2121
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
2222
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
23-
github.com/go-playground/validator/v10 v10.19.0 h1:ol+5Fu+cSq9JD7SoSqe04GMI92cbn0+wvQ3bZ8b/AU4=
24-
github.com/go-playground/validator/v10 v10.19.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
25-
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
23+
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
24+
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
2625
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
26+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
27+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
2728
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
2829
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
2930
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
@@ -50,28 +51,28 @@ github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
5051
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
5152
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
5253
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
53-
github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=
54-
github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg=
54+
github.com/onsi/gomega v1.37.0 h1:CdEG8g0S133B4OswTDC/5XPSzE1OeP29QOioj2PID2Y=
55+
github.com/onsi/gomega v1.37.0/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
5556
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
5657
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
57-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
58-
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
59-
go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80=
60-
go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c=
61-
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
62-
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
63-
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
64-
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
65-
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
66-
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
67-
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
68-
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
58+
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
59+
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
60+
go.mongodb.org/mongo-driver v1.17.2 h1:gvZyk8352qSfzyZ2UMWcpDpMSGEr1eqE4T793SqyhzM=
61+
go.mongodb.org/mongo-driver v1.17.2/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
62+
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
63+
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
64+
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
65+
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
66+
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
67+
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
68+
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
69+
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
6970
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7071
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
7172
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
7273
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
7374
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
74-
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
75-
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
7675
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
7776
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
77+
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
78+
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=

go.sum

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,6 @@ github.com/IBM/vmware-go-sdk v0.1.5 h1:aQbwcJBceaaauuIoJ0OJn+ttwjb+QTX6XV9Jbrdpj
169169
github.com/IBM/vmware-go-sdk v0.1.5/go.mod h1:OyQKRInGGsBaOyE5LIZCqH7b1DZ01BvIYa8BgGy+wWo=
170170
github.com/IBM/vpc-beta-go-sdk v0.8.0 h1:cEPpv4iw3Ba5W2d0AWg3TIbKeJ8y1nPuUuibR5Jt9eE=
171171
github.com/IBM/vpc-beta-go-sdk v0.8.0/go.mod h1:hORgIyTFRzXrZIK9IohaWmCRBBlYiDRagsufi7M6akE=
172-
github.com/IBM/vpc-go-sdk v0.70.1 h1:6NsbRkiA5gDNxe7cjNx8Pi1j9s0PlhwNQj29wsKZxAo=
173-
github.com/IBM/vpc-go-sdk v0.70.1/go.mod h1:K3vVlje72PYE3ZRt1iouE+jSIq+vCyYzT1HiFC06hUA=
174172
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0=
175173
github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56/go.mod h1:Zb3OT4l0mf7P/GOs2w2Ilj5sdm5Whoq3pa24dAEBHFc=
176174
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=

ibm/service/vpc/data_source_ibm_is_instance.go

Lines changed: 80 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,54 @@ func DataSourceIBMISInstance() *schema.Resource {
6363
Required: true,
6464
Description: "Instance name",
6565
},
66+
// shared core
67+
"vcpu": &schema.Schema{
68+
Type: schema.TypeList,
69+
Computed: true,
70+
Description: "The virtual server instance VCPU configuration.",
71+
Elem: &schema.Resource{
72+
Schema: map[string]*schema.Schema{
73+
"architecture": &schema.Schema{
74+
Type: schema.TypeString,
75+
Computed: true,
76+
Description: "The VCPU architecture.The enumerated values for this property may[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.",
77+
},
78+
"burst": &schema.Schema{
79+
Type: schema.TypeList,
80+
Computed: true,
81+
Elem: &schema.Resource{
82+
Schema: map[string]*schema.Schema{
83+
"limit": &schema.Schema{
84+
Type: schema.TypeInt,
85+
Computed: true,
86+
Description: "The maximum percentage the virtual server instance will exceed its allocated share of VCPU time.The maximum value for this property may[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.",
87+
},
88+
},
89+
},
90+
},
91+
"count": &schema.Schema{
92+
Type: schema.TypeInt,
93+
Computed: true,
94+
Description: "The number of VCPUs assigned.",
95+
},
96+
"manufacturer": &schema.Schema{
97+
Type: schema.TypeString,
98+
Computed: true,
99+
Description: "The VCPU manufacturer.The enumerated values for this property may[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.",
100+
},
101+
"percentage": &schema.Schema{
102+
Type: schema.TypeInt,
103+
Computed: true,
104+
Description: "The percentage of VCPU time allocated to the virtual server instance.The virtual server instance `vcpu.percentage` will be `100` when:- The virtual server instance `placement_target` is a dedicated host or dedicated host group.- The virtual server instance `reservation_affinity.policy` is `disabled`.",
105+
},
106+
"tenancy": &schema.Schema{
107+
Type: schema.TypeString,
108+
Computed: true,
109+
Description: "Indicates the tenancy of the VCPU cores for this virtual server instance.- `dedicated` - The VCPU time is only used by this virtual server instance.- `shared` - The VCPU time is shared across virtual server instances.The enumerated values for this property may[expand](https://cloud.ibm.com/apidocs/vpc#property-value-expansion) in the future.",
110+
},
111+
},
112+
},
113+
},
66114
// cluster changes
67115
"cluster_network": &schema.Schema{
68116
Type: schema.TypeList,
@@ -930,33 +978,6 @@ func DataSourceIBMISInstance() *schema.Resource {
930978
Computed: true,
931979
Description: "Instance resource group",
932980
},
933-
934-
isInstanceCPU: {
935-
Type: schema.TypeList,
936-
Computed: true,
937-
Description: "Instance vCPU",
938-
Elem: &schema.Resource{
939-
Schema: map[string]*schema.Schema{
940-
isInstanceCPUArch: {
941-
Type: schema.TypeString,
942-
Computed: true,
943-
Description: "Instance vCPU Architecture",
944-
},
945-
isInstanceCPUCount: {
946-
Type: schema.TypeInt,
947-
Computed: true,
948-
Description: "Instance vCPU count",
949-
},
950-
// Added for AMD support, manufacturer details.
951-
isInstanceCPUManufacturer: {
952-
Type: schema.TypeString,
953-
Computed: true,
954-
Description: "Instance vCPU Manufacturer",
955-
},
956-
},
957-
},
958-
},
959-
960981
isInstanceGpu: {
961982
Type: schema.TypeList,
962983
Computed: true,
@@ -1430,16 +1451,16 @@ func instanceGetByName(context context.Context, d *schema.ResourceData, meta int
14301451
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting availability_policy_host_failure: %s", err), "(Data) ibm_is_instance", "read", "set-availability_policy_host_failure").GetDiag()
14311452
}
14321453
}
1433-
cpuList := make([]map[string]interface{}, 0)
14341454
if instance.Vcpu != nil {
1435-
currentCPU := map[string]interface{}{}
1436-
currentCPU[isInstanceCPUArch] = *instance.Vcpu.Architecture
1437-
currentCPU[isInstanceCPUCount] = *instance.Vcpu.Count
1438-
currentCPU[isInstanceCPUManufacturer] = *instance.Vcpu.Manufacturer // Added for AMD support, manufacturer details.
1439-
cpuList = append(cpuList, currentCPU)
1440-
}
1441-
if err = d.Set(isInstanceCPU, cpuList); err != nil {
1442-
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting vcpu: %s", err), "(Data) ibm_is_instance", "read", "set-vcpu").GetDiag()
1455+
vcpu := []map[string]interface{}{}
1456+
vcpuMap, err := DataSourceIBMIsInstanceInstanceVcpuToMap(instance.Vcpu)
1457+
if err != nil {
1458+
return flex.DiscriminatedTerraformErrorf(err, err.Error(), "(Data) ibm_is_instance", "read", "vcpu-to-map").GetDiag()
1459+
}
1460+
vcpu = append(vcpu, vcpuMap)
1461+
if err = d.Set("vcpu", vcpu); err != nil {
1462+
return flex.DiscriminatedTerraformErrorf(err, fmt.Sprintf("Error setting vcpu: %s", err), "(Data) ibm_is_instance", "read", "set-vcpu").GetDiag()
1463+
}
14431464
}
14441465
if instance.PlacementTarget != nil {
14451466
placementTargetMap := resourceIbmIsInstanceInstancePlacementToMap(*instance.PlacementTarget.(*vpcv1.InstancePlacementTarget))
@@ -2173,3 +2194,26 @@ func DataSourceIBMIsInstanceDeletedToMap(model *vpcv1.Deleted) (map[string]inter
21732194
modelMap["more_info"] = *model.MoreInfo
21742195
return modelMap, nil
21752196
}
2197+
2198+
func DataSourceIBMIsInstanceInstanceVcpuToMap(model *vpcv1.InstanceVcpu) (map[string]interface{}, error) {
2199+
modelMap := make(map[string]interface{})
2200+
modelMap["architecture"] = *model.Architecture
2201+
if model.Burst != nil {
2202+
burstMap, err := DataSourceIBMIsInstanceInstanceVcpuBurstToMap(model.Burst)
2203+
if err != nil {
2204+
return modelMap, err
2205+
}
2206+
modelMap["burst"] = []map[string]interface{}{burstMap}
2207+
}
2208+
modelMap["count"] = flex.IntValue(model.Count)
2209+
modelMap["manufacturer"] = *model.Manufacturer
2210+
modelMap["percentage"] = flex.IntValue(model.Percentage)
2211+
modelMap["tenancy"] = *model.Tenancy
2212+
return modelMap, nil
2213+
}
2214+
2215+
func DataSourceIBMIsInstanceInstanceVcpuBurstToMap(model *vpcv1.InstanceVcpuBurst) (map[string]interface{}, error) {
2216+
modelMap := make(map[string]interface{})
2217+
modelMap["limit"] = flex.IntValue(model.Limit)
2218+
return modelMap, nil
2219+
}

0 commit comments

Comments
 (0)