{"id":18758653,"url":"https://github.com/patrickcping/pingfederate-terraform-export","last_synced_at":"2025-12-02T05:30:14.407Z","repository":{"id":218742227,"uuid":"747118756","full_name":"patrickcping/pingfederate-terraform-export","owner":"patrickcping","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-23T14:43:48.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-29T03:28:15.859Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patrickcping.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-23T09:56:09.000Z","updated_at":"2024-01-23T14:40:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"6357110b-1440-45b2-b5d9-ab7241b73b5f","html_url":"https://github.com/patrickcping/pingfederate-terraform-export","commit_stats":null,"previous_names":["patrickcping/pingfederate-terraform-export"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcping%2Fpingfederate-terraform-export","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcping%2Fpingfederate-terraform-export/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcping%2Fpingfederate-terraform-export/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickcping%2Fpingfederate-terraform-export/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickcping","download_url":"https://codeload.github.com/patrickcping/pingfederate-terraform-export/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239650760,"owners_count":19674805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T17:47:06.882Z","updated_at":"2025-12-02T05:30:14.367Z","avatar_url":"https://github.com/patrickcping.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pingfederate-terraform-export\n\nThe scripts in this repository are meant as a helper to extract configuration from a running PingFederate instance, populate a Terraform HCL file with the appropriate `import {}` blocks, which in turn can generate full Terraform HCL.\n\nMore information about the Terraform `import {}` block and it's use when generating HCL can be found on [Terraform's Configuration Language Documentation](https://developer.hashicorp.com/terraform/language/import).\n\n## Requirements\n\n* The script is a shell script.  A bash (or equivalent) shell terminal must be used.\n* `jq` must be installed.\n* `curl` must be installed.\n* The script supports Basic auth to the APIs.  If using your own PingFederate instance, ensure Basic auth is enabled.\n\n## QuickStart\n\nThe following instructions are a quickstart for using the tool.\n\nFirst, clone the repo and set our current directory:\n```shell\ngit clone https://github.com/patrickcping/pingfederate-terraform-export.git\ncd pingfederate-terraform-export\nPF_TF_EXPORT=`pwd`\n```\n\nFor testing, run the docker container locally.\n\n**Before running a docker image locally, ensure all the pre-reqs are met by following the [Getting Started pre-reqs](https://devops.pingidentity.com/get-started/prereqs/) at [devops.pingidentity.com](https://devops.pingidentity.com/)\n```shell\ndocker run --name pingfederate_terraform_provider_container \\\n\t\t-d -p 9031:9031 \\\n\t\t-d -p 9999:9999 \\\n\t\t--env-file \"${HOME}/.pingidentity/config\" \\\n\t\t-e SERVER_PROFILE_URL=https://github.com/pingidentity/pingidentity-server-profiles.git \\\n\t\t-e SERVER_PROFILE_BRANCH=2312 \\\n\t\t-e SERVER_PROFILE_PATH=baseline/pingfederate \\\n\t\tpingidentity/pingfederate:12.0.0-latest\n```\n\nTail the logs to ensure the server has started:\n```shell\ndocker logs -f pingfederate_terraform_provider_container\n```\n\nInitialise Terraform:\n```shell\ncd $PF_TF_EXPORT/terraform\nterraform init\n```\n\nOptional: Prepare the script for use with a different PingFederate.\n* Open the file `$PF_TF_EXPORT/scripts/generate_import_blocks.sh`\n* In the `Configuration` block, modify:\n  * The `API_BASE_URL` parameter for your own PingFederate instance (e.g. `https://localhost:9999/pf-admin-api/v1`)\n  * The `API_USERNAME` parameter for connecting to the PingFederate API using basic auth\n  * The `API_PASSWORD` parameter for connecting to the PingFederate API using basic auth\n* Save the file.\n\nRun the script to pull configuration as `import {}` blocks:\n```shell\ncd $PF_TF_EXPORT/scripts\n./generate_import_blocks.sh\n```\n\nThe file will have generated `$PF_TF_EXPORT/terraform/import.tf`.\n\nUse Terraform to generate HCL from the `import {}` blocks:\n```shell\ncd $PF_TF_EXPORT/terraform\nterraform plan -generate-config-out=generated.tf\n```\n\nThe HCL will have been generated in the `$PF_TF_EXPORT/terraform/generated.tf` file and can be modified as needed.\n\n**A number of errors will be observed because the generated HCL has not been generated cleanly.  There are limitations of the Terraform HCL generation routine as well as in the provider.**\n\n**Manual work is required to clean and re-format the HCL as needed.**\n\n## Cleanup\n\nStop the Docker container:\n```shell\ndocker stop pingfederate_terraform_provider_container\n```\n\nRemove the Docker container:\n\n```shell\ndocker container rm pingfederate_terraform_provider_container\n```\n\n## Limitations\n\nThe script is provided as a guide only.  Resources that can be extracted are found in the `scripts/ProviderMappings.json` file and this file can be extended as needed.  The list of resources that can be exported as `import {}` blocks are:\n\n* `pingfederate_authentication_policy_contract` - [Terraform Registry Doc Link](https://registry.terraform.io/providers/pingidentity/pingfederate/latest/docs/resources/authentication_policy_contract)\n* `pingfederate_idp_adapter` - [Terraform Registry Doc Link](https://registry.terraform.io/providers/pingidentity/pingfederate/latest/docs/resources/pingfederate_idp_adapter)\n* `pingfederate_idp_sp_connection` - [Terraform Registry Doc Link](https://registry.terraform.io/providers/pingidentity/pingfederate/latest/docs/resources/pingfederate_idp_sp_connection)\n* `pingfederate_password_credential_validator` - [Terraform Registry Doc Link](https://registry.terraform.io/providers/pingidentity/pingfederate/latest/docs/resources/pingfederate_password_credential_validator)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickcping%2Fpingfederate-terraform-export","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickcping%2Fpingfederate-terraform-export","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickcping%2Fpingfederate-terraform-export/lists"}