sparse-intern-71089
05/25/2023, 5:13 PMfresh-scientist-56300
05/25/2023, 5:14 PMfresh-scientist-56300
05/25/2023, 5:23 PMmake tfgen errors with:
error: failed to gather package metadata: problem gathering resources: 2 errors occurred:
* TF resource "fortios_switchcontroller_8021Xsettings" not mapped to the Pulumi provider
* TF resource "fortios_switchcontrollersecuritypolicy_8021X" not mapped to the Pulumi providerfresh-scientist-56300
05/25/2023, 5:32 PMbig-architect-71258
05/28/2023, 1:49 PMresources.go file, located in the provider directory. tfgen creates a schema file for the pulumi provider which must contain all components exposed by the Terraform provider. tfgen will check this requirement and issue an error respectively. If you want to use a more gradual approach, you can add data sources and resources to the IgnoreMappings: []string{} property of tfbridge.ProviderInfo. As the name implies, `tfgen`will ignore the elements. But be warned: the generated Pulumi provider will not support those components at all.big-architect-71258
05/28/2023, 2:00 PMbig-architect-71258
05/28/2023, 2:02 PMresources.go when I created a new repo using the Cookiecutter template.big-architect-71258
05/28/2023, 2:37 PMresources.go in the project I scaffolded using my Cookiecutter template. I can successfully generate the provider. Find attached resources.gofresh-scientist-56300
05/28/2023, 4:48 PMbig-architect-71258
05/28/2023, 4:56 PMfresh-scientist-56300
05/30/2023, 5:30 PMresources.go file:
/pulumi-fortios on ī main [?] on š³ v23.0.5 via vcookiecutter
ā make tfgen
[ -x /opt/homebrew/bin/pulumi ] || curl -fsSL <https://get.pulumi.com> | sh
pulumi plugin install resource random 4.3.1
(cd provider && go build -o /Users/dhagen/Projects/Work/pulumi-fortios/pulumi-fortios/bin/pulumi-tfgen-fortios -ldflags "-X <http://github.com/pulumiverse/pulumi-fortios/provider/pkg/version.Version=0.0.1-alpha.1685467686+7123a155|github.com/pulumiverse/pulumi-fortios/provider/pkg/version.Version=0.0.1-alpha.1685467686+7123a155>" <http://github.com/pulumiverse/pulumi-fortios/provider/cmd/pulumi-tfgen-fortios)|github.com/pulumiverse/pulumi-fortios/provider/cmd/pulumi-tfgen-fortios)>
# <http://github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2|github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim/sdk-v2>
/Users/dhagen/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.44.3/pkg/tfshim/sdk-v2/cty.go:55:21: undefined: schema.HCL2ValueFromConfigValue
/Users/dhagen/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.44.3/pkg/tfshim/sdk-v2/upgrade_state.go:38:31: undefined: schema.UpgradeFlatmapState
/Users/dhagen/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.44.3/pkg/tfshim/sdk-v2/upgrade_state.go:44:21: undefined: schema.UpgradeJSONState
/Users/dhagen/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.44.3/pkg/tfshim/sdk-v2/upgrade_state.go:52:9: undefined: schema.RemoveAttributes
/Users/dhagen/go/pkg/mod/github.com/pulumi/pulumi-terraform-bridge/v3@v3.44.3/pkg/tfshim/sdk-v2/upgrade_state.go:69:13: undefined: schema.NormalizeObjectFromLegacySDK
make: *** [tfgen] Error 2big-architect-71258
05/30/2023, 6:15 PMfresh-scientist-56300
05/30/2023, 6:16 PMbig-architect-71258
05/30/2023, 6:17 PMfresh-scientist-56300
05/30/2023, 6:22 PMfresh-scientist-56300
05/30/2023, 6:25 PMgo.mod still specifies: module <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios> instead of module <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios> , which I fixed in our fork. I'm trying to get a PR into the original repo, but... :š¤·:big-architect-71258
05/30/2023, 6:26 PMfresh-scientist-56300
05/30/2023, 6:26 PMfresh-scientist-56300
05/30/2023, 6:41 PMcookiecutter -f gh:tmeckel/pulumi-tf-provider-cookiecutter
You've downloaded /Users/dhagen/.cookiecutters/pulumi-tf-provider-cookiecutter before. Is it okay to delete and re-download it? [yes]:
terraform_provider_name [terraform-provider-name]: fortios
terraform_provider_org [terraform-providers]: fortinetdev
terraform_provider_source [<http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>]:
terraform_provider_version_or_commit [0.0.0]: 1.16.0
terraform_provider_module [<http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>]:
terraform_provider_package_name [fortios]:
Select terraform_sdk_version:
1 - 1
2 - 2
3 - plugin-framework
Choose from 1, 2, 3 [1]:
provider [pulumi-fortios]:
provider_display_name [Fortios]:
provider_github_organization [pulumiverse]:
provider_publisher [pulumiverse]:
provider_homepage [<https://github.com/pulumiverse/pulumi-fortios>]:
provider_logoUrl [<https://raw.githubusercontent.com/pulumiverse/pulumi-fortios/main/docs/fortios.png>]:
provider_description [A Pulumi package for creating and managing Fortios resources]:
Select provider_category:
1 - cloud
2 - database
3 - infrastructure
4 - monitoring
5 - network
6 - utility
7 - versioncontrol
Choose from 1, 2, 3, 4, 5, 6, 7 [1]: 5
provider_download_url [<github://api.github.com/pulumiverse/pulumi-fortios>]:
provider_javascript_package [@pulumiverse/fortios]:
provider_dotnet_rootnamespace [Pulumiverse]:
provider_python_package [pulumiverse_fortios]:
provider_java_base_package [com.pulumiverse]:
create_github_workflows [yes]:
skip_go_mod_tidy [no]:
skip_git_init [no]:
go: <http://github.com/fortinetdev/terraform-provider-fortios@v1.16.0|github.com/fortinetdev/terraform-provider-fortios@v1.16.0>: parsing go.mod:
module declares its path as: <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios>
but was required as: <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>
Initialized empty Git repository in /Users/dhagen/Projects/Work/pulumi-fortios/pulumi-fortios/.git/
[main (root-commit) 7c88da9] Initial Commit.
pulumi-fortios on ī main [?] on š³ v23.0.5 via vcookiecutter
ā make tfgen
[ -x /opt/homebrew/bin/pulumi ] || curl -fsSL <https://get.pulumi.com> | sh
pulumi plugin install resource random 4.3.1
(cd provider && go build -o /Users/dhagen/Projects/Work/pulumi-fortios/pulumi-fortios/bin/pulumi-tfgen-fortios -ldflags "-X <http://github.com/pulumiverse/pulumi-fortios/provider/pkg/version.Version=0.0.1-alpha.1685471875+7c88da98|github.com/pulumiverse/pulumi-fortios/provider/pkg/version.Version=0.0.1-alpha.1685471875+7c88da98>" <http://github.com/pulumiverse/pulumi-fortios/provider/cmd/pulumi-tfgen-fortios)|github.com/pulumiverse/pulumi-fortios/provider/cmd/pulumi-tfgen-fortios)>
resources.go:23:2: <http://github.com/fortinetdev/terraform-provider-fortios@v1.16.0|github.com/fortinetdev/terraform-provider-fortios@v1.16.0>: parsing go.mod:
module declares its path as: <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios>
but was required as: <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>
resources.go:31:2: <http://github.com/fortinetdev/terraform-provider-fortios@v1.16.0|github.com/fortinetdev/terraform-provider-fortios@v1.16.0>: parsing go.mod:
module declares its path as: <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios>
but was required as: <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>
resources.go:26:2: <http://github.com/fortinetdev/terraform-provider-fortios@v1.16.0|github.com/fortinetdev/terraform-provider-fortios@v1.16.0>: parsing go.mod:
module declares its path as: <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios>
but was required as: <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>
cmd/pulumi-tfgen-fortios/main.go:20:2: <http://github.com/fortinetdev/terraform-provider-fortios@v1.16.0|github.com/fortinetdev/terraform-provider-fortios@v1.16.0>: parsing go.mod:
module declares its path as: <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios>
but was required as: <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>
resources.go:27:2: <http://github.com/fortinetdev/terraform-provider-fortios@v1.16.0|github.com/fortinetdev/terraform-provider-fortios@v1.16.0>: parsing go.mod:
module declares its path as: <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios>
but was required as: <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>
resources.go:28:2: <http://github.com/fortinetdev/terraform-provider-fortios@v1.16.0|github.com/fortinetdev/terraform-provider-fortios@v1.16.0>: parsing go.mod:
module declares its path as: <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios>
but was required as: <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>
resources.go:30:2: <http://github.com/fortinetdev/terraform-provider-fortios@v1.16.0|github.com/fortinetdev/terraform-provider-fortios@v1.16.0>: parsing go.mod:
module declares its path as: <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios>
but was required as: <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>
resources.go:24:2: <http://github.com/fortinetdev/terraform-provider-fortios@v1.16.0|github.com/fortinetdev/terraform-provider-fortios@v1.16.0>: parsing go.mod:
module declares its path as: <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios>
but was required as: <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>
resources.go:25:2: <http://github.com/fortinetdev/terraform-provider-fortios@v1.16.0|github.com/fortinetdev/terraform-provider-fortios@v1.16.0>: parsing go.mod:
module declares its path as: <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios>
but was required as: <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>
make: *** [tfgen] Error 1big-architect-71258
05/30/2023, 6:44 PMfresh-scientist-56300
05/30/2023, 6:44 PMbig-architect-71258
05/31/2023, 7:40 AMtfgen is complaining about missing resource and data source mapping. Find attached the generated go.mod file from the provider directory. And the used cookiecutter replay JSON file.
The most important line in the go.mod file:
replace <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios> => <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios> v1.16.0big-architect-71258
05/31/2023, 7:44 AMresources.go that I sent you, into the scaffolded provider which uses the original repo of Fortios you'll receive the following error
resources.go:21:2: no required module provides package <http://github.com/aspyrmedia/pulumi-fortios/provider/pkg/version;|github.com/aspyrmedia/pulumi-fortios/provider/pkg/version;> to add it:
go get <http://github.com/aspyrmedia/pulumi-fortios/provider/pkg/version|github.com/aspyrmedia/pulumi-fortios/provider/pkg/version>
resources.go:22:2: no required module provides package <http://github.com/aspyrmedia/terraform-provider-fortios/fortios;|github.com/aspyrmedia/terraform-provider-fortios/fortios;> to add it:
go get <http://github.com/aspyrmedia/terraform-provider-fortios/fortios|github.com/aspyrmedia/terraform-provider-fortios/fortios>
What is correct because the import statements do not match (see image).big-architect-71258
05/31/2023, 8:07 AM"<http://github.com/pulumiverse/pulumi-fortios/provider/pkg/version|github.com/pulumiverse/pulumi-fortios/provider/pkg/version>"
"<http://github.com/terraform-providers/terraform-provider-fortios/fortios|github.com/terraform-providers/terraform-provider-fortios/fortios>"big-architect-71258
05/31/2023, 12:36 PMPULUMI_REPO_PATH environment variable.
Suppose you cloned the Fortios provider to $HOME/code/terraform-provider-fortios then the PULUMI_REPO_PATH must be set to export PULUMI_REPO_PATHS="<http://github.com/fortinetdev/terraform-provider-fortios=$HOME/code/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios=$HOME/code/terraform-provider-fortios>"big-architect-71258
05/31/2023, 12:50 PMbig-architect-71258
05/31/2023, 1:40 PMfresh-scientist-56300
05/31/2023, 4:28 PMā cookiecutter -f gh:tmeckel/pulumi-tf-provider-cookiecutter
You've downloaded /Users/dhagen/.cookiecutters/pulumi-tf-provider-cookiecutter before. Is it okay to delete and re-download it? [yes]: yes
Unable to load extension: No module named 'packaging'big-architect-71258
05/31/2023, 4:53 PMbig-architect-71258
05/31/2023, 6:51 PMpackaging is now required. I'll update the documentation accordingly tomorrow.
Please install packaging via pip into your virtual environment: pip install packagingfresh-scientist-56300
05/31/2023, 7:57 PMgo.mod and resource.go files and still erroring out. go mod tidy in /provider results in:
pulumi-fortios/provider on ī main [?] via š¹ v1.19 on š³ v23.0.5 via vcookiecutter
ā go mod tidy
go: finding module for package <http://github.com/fortinetdev/terraform-provider-fortios/fortios|github.com/fortinetdev/terraform-provider-fortios/fortios>
go: found <http://github.com/fortinetdev/terraform-provider-fortios/fortios|github.com/fortinetdev/terraform-provider-fortios/fortios> in <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios> v1.16.0
go: <http://github.com/pulumiverse/pulumi-fortios/provider|github.com/pulumiverse/pulumi-fortios/provider> imports
<http://github.com/fortinetdev/terraform-provider-fortios/fortios|github.com/fortinetdev/terraform-provider-fortios/fortios>: <http://github.com/fortinetdev/terraform-provider-fortios@v1.16.0|github.com/fortinetdev/terraform-provider-fortios@v1.16.0>: parsing go.mod:
module declares its path as: <http://github.com/terraform-providers/terraform-provider-fortios|github.com/terraform-providers/terraform-provider-fortios>
but was required as: <http://github.com/fortinetdev/terraform-provider-fortios|github.com/fortinetdev/terraform-provider-fortios>
Everything is pushed up to https://github.com/aspyrmedia/pulumi-fortiosbig-architect-71258
05/31/2023, 8:03 PMbig-architect-71258
05/31/2023, 8:04 PMfresh-scientist-56300
05/31/2023, 8:29 PMfresh-scientist-56300
05/31/2023, 8:30 PMbig-architect-71258
05/31/2023, 8:33 PMbig-architect-71258
06/01/2023, 10:44 AMCSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Inputs/RouterbgpNeighborConditionalAdvertise6Args.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Inputs/RouterBgpNeighborConditionalAdvertise6GetArgs.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Inputs/RouterBgpNeighborConditionalAdvertiseArgs.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Inputs/RouterBgpNeighborConditionalAdvertiseGetArgs.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Inputs/RouterOspf6Ospf6InterfaceIpsecKeyArgs.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Inputs/Routerospf6Ospf6interfaceIpsecKeyGetArgs.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Inputs/Routerospf6Ospf6interfaceNeighborArgs.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Inputs/RouterOspf6Ospf6InterfaceNeighborGetArgs.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Inputs/RouterospfOspfinterfaceMd5KeyArgs.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Inputs/RouterospfOspfinterfaceMd5KeyGetArgs.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Outputs/GetRouterbgpNeighborConditionalAdvertise6Result.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Outputs/GetRouterBgpNeighborConditionalAdvertiseResult.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Outputs/RouterbgpNeighborConditionalAdvertise.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Outputs/RouterBgpNeighborConditionalAdvertise6.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Outputs/RouterOspf6Ospf6InterfaceIpsecKey.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Outputs/RouterOspf6Ospf6InterfaceNeighbor.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
CSC : warning CS2002: Source file '/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Outputs/RouterospfOspfinterfaceMd5Key.cs' specified multiple times [/home/vagrant/code/pulumi-fortios-aspyrmedia/sdk/dotnet/Pulumiverse.Fortios.csproj]
I think the codegen must be tweaked for Dotnet or tfgen has a bug. I don't want to rule it out, as the Fortios provider is really very poorly implemented. NodeJs, Go and Python seem to be fine though.
If you wanna test the provider you can just build it via make provider and create an (empty) Pulumi YAML project. Ensure that Pulumi can find the provider implementation by expanding the PATH environment variable.big-architect-71258
06/01/2023, 10:51 AMbig-architect-71258
06/01/2023, 11:25 AMindex module. When you look at huge providers like Aws or Azure (Classic) you'll see that resources and datasources go to different modules to prevent clashes and duplicate names.fresh-scientist-56300
06/01/2023, 3:35 PMfresh-scientist-56300
06/01/2023, 3:36 PMbig-architect-71258
06/01/2023, 3:38 PM