Skip to content

Commit

Permalink
add resource importer for all resources
Browse files Browse the repository at this point in the history
  • Loading branch information
halradaideh committed Aug 20, 2023
1 parent d9d98de commit d69645e
Show file tree
Hide file tree
Showing 23 changed files with 48 additions and 186 deletions.
22 changes: 1 addition & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,68 +17,48 @@ require (
github.com/hashicorp/terraform-plugin-log v0.9.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.1 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/stretchr/testify v1.8.1 // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
)

require (
cloud.google.com/go v0.110.0 // indirect
cloud.google.com/go/storage v1.28.1 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-cidr v1.1.0 // indirect
github.com/apparentlymart/go-textseg/v12 v12.0.0 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/aws/aws-sdk-go v1.37.0 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-getter v1.5.3 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.10 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/hcl/v2 v2.17.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.18.1 // indirect
github.com/hashicorp/terraform-json v0.17.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.16.0 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/klauspost/compress v1.11.2 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.0.0 // indirect
github.com/ulikunitz/xz v0.5.8 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/zclconf/go-cty v1.13.2 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.10.0 // indirect
//golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.11.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/text v0.10.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/api v0.110.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.56.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
157 changes: 0 additions & 157 deletions zabbix/data_source_zabbix_server_test.go

This file was deleted.

3 changes: 3 additions & 0 deletions zabbix/resource_zabbix_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ var actionOperationCommandSchema = &schema.Resource{
Set: OperationCommandHash,
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
}

func OperationCommandHash(v interface{}) int {
Expand Down
3 changes: 3 additions & 0 deletions zabbix/resource_zabbix_auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ func resourceZabbixAuthenticationSettings() *schema.Resource {
Computed: true,
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions zabbix/resource_zabbix_host.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func resourceZabbixHost() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString},
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions zabbix/resource_zabbix_host_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func resourceZabbixHostGroup() *schema.Resource {
Computed: true,
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions zabbix/resource_zabbix_host_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ func resourceZabbixHostInterface() *schema.Resource {
},
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions zabbix/resource_zabbix_housekeeping_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ func resourceZabbixHousekeepingSettings() *schema.Resource {
Computed: true,
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
}
}

Expand Down
2 changes: 1 addition & 1 deletion zabbix/resource_zabbix_item.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func resourceZabbixItem() *schema.Resource {
Update: resourceZabbixItemUpdate,
Delete: resourceZabbixItemDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
StateContext: schema.ImportStatePassthroughContext,
},
Schema: map[string]*schema.Schema{
"delay": &schema.Schema{
Expand Down
2 changes: 1 addition & 1 deletion zabbix/resource_zabbix_item_prototype.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func resourceZabbixItemPrototype() *schema.Resource {
Update: resourceZabbixItemPrototypeUpdate,
Delete: resourceZabbixItemPrototypeDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
StateContext: schema.ImportStatePassthroughContext,
},
Schema: map[string]*schema.Schema{
"delay": &schema.Schema{
Expand Down
2 changes: 1 addition & 1 deletion zabbix/resource_zabbix_lld_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func resourceZabbixLLDRule() *schema.Resource {
Update: resourceZabbixLLDRuleUpdate,
Delete: resourceZabbixLLDRuleDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
StateContext: schema.ImportStatePassthroughContext,
},
Schema: map[string]*schema.Schema{
"delay": &schema.Schema{
Expand Down
2 changes: 1 addition & 1 deletion zabbix/resource_zabbix_lld_rule_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func resourceZabbixLLDRuleLink() *schema.Resource {
Update: resourceZabbixLLDRuleLinkUpdate,
Delete: resourceZabbixLLDRuleLinkDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
StateContext: schema.ImportStatePassthroughContext,
},
Schema: map[string]*schema.Schema{
"lld_rule_id": &schema.Schema{
Expand Down
3 changes: 3 additions & 0 deletions zabbix/resource_zabbix_mediatype_email.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ func resourceZabbixMediaTypeEmail() *schema.Resource {
Computed: true,
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions zabbix/resource_zabbix_mediatype_script.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func resourceZabbixMediaTypeScript() *schema.Resource {
Optional: true,
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions zabbix/resource_zabbix_mediatype_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ func resourceZabbixMediaTypeWebhook() *schema.Resource {
},
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions zabbix/resource_zabbix_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ func resourceZabbixProxy() *schema.Resource {
},
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
}
}

Expand Down
3 changes: 3 additions & 0 deletions zabbix/resource_zabbix_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ func resourceZabbixRole() *schema.Resource {
Computed: true,
},
},
Importer: &schema.ResourceImporter{
StateContext: schema.ImportStatePassthroughContext,
},
}
}

Expand Down
2 changes: 1 addition & 1 deletion zabbix/resource_zabbix_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func resourceZabbixTemplate() *schema.Resource {
Update: resourceZabbixTemplateUpdate,
Delete: resourceZabbixTemplateDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
StateContext: schema.ImportStatePassthroughContext,
},
Schema: map[string]*schema.Schema{
"host": &schema.Schema{
Expand Down
2 changes: 1 addition & 1 deletion zabbix/resource_zabbix_template_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func resourceZabbixTemplateLink() *schema.Resource {
Update: resourceZabbixTemplateLinkUpdate,
Delete: resourceZabbixTemplateLinkDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
StateContext: schema.ImportStatePassthroughContext,
},
Schema: map[string]*schema.Schema{
"template_id": &schema.Schema{
Expand Down
Loading

0 comments on commit d69645e

Please sign in to comment.