Skip to content

unmarshal string into Go struct field .code of type int #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MartinForReal opened this issue Oct 18, 2018 · 9 comments
Closed

unmarshal string into Go struct field .code of type int #2

MartinForReal opened this issue Oct 18, 2018 · 9 comments

Comments

@MartinForReal
Copy link

MartinForReal commented Oct 18, 2018

I got this error when creating security group resource using terraform plugin

tencentcloud_security_group.alauda_int_group: json: cannot unmarshal string into Go struct field .code of type int
resource "tencentcloud_security_group" "alauda_int_group" {
  name        = "web accessibility"
  description = "make it accessable for both production and stage ports"
}

It seems that I don't have access to creating security group

@zqfan
Copy link
Contributor

zqfan commented Oct 24, 2018

Thanks for reporting this, but I cannot reproduce this bug, it seems API doesn't return correct information as the document promised. Can you please open terraform debug log, like export TF_LOG=DEBUG then run it again, and paste the log here?

@MartinForReal
Copy link
Author

2018-10-25T14:26:45.080+0800 [DEBUG] plugin.terraform-provider-tencentcloud_v1.2.2_x4: 2018/10/25 14:26:45 client.go:85: [DEBUG] [tencentcloud-sdk-go] request ended: action=DescribeSecurityGroupEx, url=https://dfw.api.qcloud.com/v2/index.php, params=map[Timestamp:[1540448801] Nonce:[7274928772206554761] Region:[ap-chongqing] Action:[DescribeSecurityGroupEx] projectId:[0] Signature:[] sgId:[sg-046r9ija] SecretId:[]], response={"code":0,"message":"","codeDesc":"Success","data":{"totalNum":0,"detail":[]}}

but it should be

curl -d "Action=DescribeSecurityGroups&Nonce=8117&Region=ap-chongqing&SecretId=AKID5ybBXdZ1KOCj03dOuDGAoDNHvQilLAXm&SecurityGroupIds.0=sg-046r9ija&Signature=****&Timestamp=1540449406&Version=2017-03-12" "https://vpc.ap-chongqing.tencentcloudapi.com"

@zqfan
Copy link
Contributor

zqfan commented Oct 25, 2018

can you attach the full log? if you feel too hard to mask the sensitive data, you can directly send it to [email protected]
ps: when terraform is developed, there is only api 2.0 available for vpc(dfw), so you will see the endpoint terraform requested is dfw.api.qcloud.com, not vpc.tencentcloudapi.com

@zqfan
Copy link
Contributor

zqfan commented Nov 6, 2018

@MartinForReal Hi, is there any update for this issue? We need advanced info to help us reproduce the problem and fix it. Thanks

@lubars
Copy link

lubars commented Mar 11, 2019

Hi @zqfan,

I encountered this same error, but for a resource of type tencentcloud_cbs_storage:

* tencentcloud_cbs_storage.data: json: cannot unmarshal string into Go struct field .code of type int

Do you believe these errors have the same origin?

@zqfan
Copy link
Contributor

zqfan commented Mar 14, 2019

I think they both are caused by inconsistent APIs' response, sometimes API returns int type code, sometimes string while go expects int type then it fails

Himer added a commit that referenced this issue Jun 11, 2019
@likexian
Copy link
Contributor

Hello @lubars
Do you still got this error when creating security group?

@likexian
Copy link
Contributor

Hello @MartinForReal
We have refactoring the security_group, would you please have a try with the new release?

@likexian
Copy link
Contributor

If there is any problems, please open a new issue.

likexian pushed a commit that referenced this issue Nov 22, 2019
likexian pushed a commit that referenced this issue Mar 9, 2020
likexian pushed a commit that referenced this issue May 25, 2020
Merge pull request #420 from Himer/master
gailwang added a commit that referenced this issue Aug 14, 2020
[add datasource and enhance testacc]
ivandksun referenced this issue in ivandksun/terraform-provider-tencentcloud Jun 9, 2021
# This is the 1st commit message:

修改拼写错误 favorate -> favorite, 解决 https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/resources/instance 中的错误

添加支持 clb 创建目标工作组的逻辑,添加相应函数的参数

修复新添加的命令行参数错误,Elem字段使用 schema.Resource指针

添加安全组对内网clb的支持(注释掉对当前网络是否为内网的判断)

添加支持开启和关闭CLB安全组默认放通的配置

添加terraform支持external CLB创建AZ实例

添加clb创建目标工作组中,调用create后的update操作中的 port 字段

添加create中调用update操作时,设置load_balancer_pass_to_target

修改在 resourceTencentCloudClbInstanceUpdate 中对 LoadBalancerPassToTarget 取值的处理,修复 tf 文件该值有变化时,没有触发更改的问题

修改支持internal CLB的security group 中description注释部分

添加调用 CreateClusterInstances时,传入imageId参数来指定镜像,以及对镜像的验证,满足 img-xxx 的格式

# This is the commit message #2:

回退版本(添加镜像),该文件不再维护
rostachen pushed a commit that referenced this issue Jun 9, 2021
* 修改拼写错误 favorate -> favorite, 解决 https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/resources/instance 中的错误

* 添加支持 clb 创建目标工作组的逻辑,添加相应函数的参数

* 修复新添加的命令行参数错误,Elem字段使用 schema.Resource指针

* 添加安全组对内网clb的支持(注释掉对当前网络是否为内网的判断)

* 添加支持开启和关闭CLB安全组默认放通的配置

* 添加terraform支持external CLB创建AZ实例

* 添加clb创建目标工作组中,调用create后的update操作中的 port 字段

* 添加create中调用update操作时,设置load_balancer_pass_to_target

* 修改在 resourceTencentCloudClbInstanceUpdate 中对 LoadBalancerPassToTarget 取值的处理,修复 tf 文件该值有变化时,没有触发更改的问题

* 修改支持internal CLB的security group 中description注释部分

* 添加调用 CreateClusterInstances时,传入imageId参数来指定镜像,以及对镜像的验证,满足 img-xxx 的格式

* 回退版本(添加镜像),该文件不再维护

* 修改命令行参数的key, os -> img_id

* 修改tke资源is_non_static_ip_mode描述不当的错误, static -> non-static

* 添加Update操作对Port的支持

* 需求 支持external CLB创建多AZ实例 Description添加master_zone及查询结果相应的字段

* 添加测试用命,及 hcl 测试说明文档注释

* 添加测试用命,及 hcl 测试说明文档注释

* 添加创建多实例,开启和关闭CLB安全组默认放通测试用例

* 完善测试文件

* 添加AS的参数 MultiZoneSubnetPolicy ,支持多可用区(子网)打散

* gendoc

* change changelog.md

* # This is a combination of 2 commits.
# This is the 1st commit message:

修改拼写错误 favorate -> favorite, 解决 https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/resources/instance 中的错误

添加支持 clb 创建目标工作组的逻辑,添加相应函数的参数

修复新添加的命令行参数错误,Elem字段使用 schema.Resource指针

添加安全组对内网clb的支持(注释掉对当前网络是否为内网的判断)

添加支持开启和关闭CLB安全组默认放通的配置

添加terraform支持external CLB创建AZ实例

添加clb创建目标工作组中,调用create后的update操作中的 port 字段

添加create中调用update操作时,设置load_balancer_pass_to_target

修改在 resourceTencentCloudClbInstanceUpdate 中对 LoadBalancerPassToTarget 取值的处理,修复 tf 文件该值有变化时,没有触发更改的问题

修改支持internal CLB的security group 中description注释部分

添加调用 CreateClusterInstances时,传入imageId参数来指定镜像,以及对镜像的验证,满足 img-xxx 的格式

# This is the commit message #2:

回退版本(添加镜像),该文件不再维护

* 修改拼写错误 favorate -> favorite, 解决 https://registry.terraform.io/providers/tencentcloudstack/tencentcloud/latest/docs/resources/instance 中的错误

添加支持 clb 创建目标工作组的逻辑,添加相应函数的参数

修复新添加的命令行参数错误,Elem字段使用 schema.Resource指针

添加安全组对内网clb的支持(注释掉对当前网络是否为内网的判断)

添加支持开启和关闭CLB安全组默认放通的配置

添加terraform支持external CLB创建AZ实例

添加clb创建目标工作组中,调用create后的update操作中的 port 字段

添加create中调用update操作时,设置load_balancer_pass_to_target

修改在 resourceTencentCloudClbInstanceUpdate 中对 LoadBalancerPassToTarget 取值的处理,修复 tf 文件该值有变化时,没有触发更改的问题

修改支持internal CLB的security group 中description注释部分

添加调用 CreateClusterInstances时,传入imageId参数来指定镜像,以及对镜像的验证,满足 img-xxx 的格式

回退版本(添加镜像),该文件不再维护

修改命令行参数的key, os -> img_id

修改tke资源is_non_static_ip_mode描述不当的错误, static -> non-static

添加Update操作对Port的支持

需求 支持external CLB创建多AZ实例 Description添加master_zone及查询结果相应的字段

添加测试用命,及 hcl 测试说明文档注释

添加测试用命,及 hcl 测试说明文档注释

添加创建多实例,开启和关闭CLB安全组默认放通测试用例

完善测试文件

添加AS的参数 MultiZoneSubnetPolicy ,支持多可用区(子网)打散

gendoc

change changelog.md

* change changelog.md: tencentcloud_container_cluster_instance -> tencentcloud_kubernetes_clusters

* change CHANGELOG.md version info

Co-authored-by: ivan <[email protected]>
ivandksun added a commit that referenced this issue Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants