Skip to content

Commit

Permalink
Activate terraform bridge type automapping
Browse files Browse the repository at this point in the history
  • Loading branch information
ringods committed Nov 8, 2024
1 parent 1328033 commit c96449c
Showing 1 changed file with 18 additions and 32 deletions.
50 changes: 18 additions & 32 deletions provider/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
provider "github.com/paultyng/terraform-provider-unifi/shim"

"github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge"
tks "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfbridge/tokens"
shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
shimv2 "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2"
"github.com/pulumi/pulumi/sdk/v3/go/common/resource"
Expand Down Expand Up @@ -166,32 +167,12 @@ func Provider() tfbridge.ProviderInfo {
},
PreConfigureCallback: preConfigureCallback,
Resources: map[string]*tfbridge.ResourceInfo{
"unifi_account": {Tok: unifiResource(mainMod, "Account")},
"unifi_device": {Tok: unifiResource(mainMod, "Device")},
"unifi_dynamic_dns": {Tok: unifiResource(mainMod, "DynamicDNS")},
"unifi_firewall_group": {Tok: unifiResource(firewallMod, "Group")},
"unifi_firewall_rule": {Tok: unifiResource(firewallMod, "Rule")},
"unifi_network": {Tok: unifiResource(mainMod, "Network")},
"unifi_port_forward": {Tok: unifiResource(portMod, "Forward")},
"unifi_port_profile": {Tok: unifiResource(portMod, "Profile")},
"unifi_radius_profile": {Tok: unifiResource(mainMod, "RadiusProfile")},
"unifi_setting_mgmt": {Tok: unifiResource(settingMod, "Mgmt")},
"unifi_setting_usg": {Tok: unifiResource(settingMod, "USG")},
"unifi_setting_radius": {Tok: unifiResource(settingMod, "Radius")},
"unifi_site": {Tok: unifiResource(mainMod, "Site")},
"unifi_static_route": {Tok: unifiResource(mainMod, "StaticRoute")},
"unifi_user": {Tok: unifiResource(iamMod, "User")},
"unifi_user_group": {Tok: unifiResource(iamMod, "Group")},
"unifi_wlan": {Tok: unifiResource(mainMod, "Wlan")},
"unifi_dynamic_dns": {Tok: unifiResource(mainMod, "DynamicDNS")},
"unifi_setting_usg": {Tok: unifiResource(settingMod, "USG")},
"unifi_user": {Tok: unifiResource(iamMod, "User")},
},
DataSources: map[string]*tfbridge.DataSourceInfo{
"unifi_account": {Tok: unifiDataSource(mainMod, "getAccount")},
"unifi_ap_group": {Tok: unifiDataSource(mainMod, "getApGroup")},
"unifi_network": {Tok: unifiDataSource(mainMod, "getNetwork")},
"unifi_port_profile": {Tok: unifiDataSource(portMod, "getProfile")},
"unifi_radius_profile": {Tok: unifiDataSource(mainMod, "getRadiusProfile")},
"unifi_user": {Tok: unifiDataSource(iamMod, "getUser")},
"unifi_user_group": {Tok: unifiDataSource(iamMod, "getGroup")},
"unifi_user": {Tok: unifiDataSource(iamMod, "getUser")},
},
JavaScript: &tfbridge.JavaScriptInfo{
PackageName: "@pulumiverse/unifi",
Expand Down Expand Up @@ -241,14 +222,19 @@ func Provider() tfbridge.ProviderInfo {
},
}

// prov.MustComputeTokens(
// tks.MappedModules(
// "grafana_",
// "index",
// namespaceMap,
// tks.MakeStandard(mainPkg),
// ),
// )
prov.MustComputeTokens(
tks.MappedModules(
"unifi_",
"index",
map[string]string{
"firewall": strings.ToLower(firewallMod),
"port": strings.ToLower(portMod),
"setting": strings.ToLower(settingMod),
"user": strings.ToLower(iamMod),
},
tks.MakeStandard(mainPkg),
),
)
prov.SetAutonaming(255, "-")
prov.MustApplyAutoAliases()

Expand Down

0 comments on commit c96449c

Please sign in to comment.