provider.go 中 添加:
ResourcesMap: map[string]*schema.Resource{
// "qingcloud_eip": resourceQingcloudEip(),
"qingcloud_keypair": resourceQingcloudKeypair(),
"qingcloud_securitygroup": resourceQingcloudSecuritygroup(),
},
ConfigureFunc: providerConfigure,
}
config.go 中 添加:
type QingCloudClient struct {
eip *eip.EIP
keypair *keypair.KEYPAIR
securitygroup *securitygroup.SECURITYGROUP
}
和
func (c *Config) Client() (*QingCloudClient, error) {
clt := qingcloud.NewClient()
clt.ConnectToZone(c.Zone, c.ID, c.Secret)
return &QingCloudClient{
eip: eip.NewClient(clt),
keypair: keypair.NewClient(clt),
securitygroup: securitygroup.NewClient(clt),
}, nil
}
- describeXXXX 需要设置请求的 params 的 verbose 为 1
- Read 必须要在拿到结果以后,设置 read