{"id":25298562,"url":"https://github.com/frankfarrell/terraform-provider-redshift","last_synced_at":"2025-10-28T04:33:21.365Z","repository":{"id":30847304,"uuid":"126173616","full_name":"frankfarrell/terraform-provider-redshift","owner":"frankfarrell","description":"Provider for AWS Redshift entities, eg Users, Groups, Permissions, Schemas, Databases","archived":false,"fork":false,"pushed_at":"2022-03-10T20:20:18.000Z","size":34594,"stargazers_count":47,"open_issues_count":14,"forks_count":29,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-09T18:43:45.152Z","etag":null,"topics":["aws","redshift","terraform","terraform-provider"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frankfarrell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-21T12:14:35.000Z","updated_at":"2023-03-07T00:27:38.000Z","dependencies_parsed_at":"2022-08-07T16:00:08.967Z","dependency_job_id":null,"html_url":"https://github.com/frankfarrell/terraform-provider-redshift","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankfarrell%2Fterraform-provider-redshift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankfarrell%2Fterraform-provider-redshift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankfarrell%2Fterraform-provider-redshift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankfarrell%2Fterraform-provider-redshift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frankfarrell","download_url":"https://codeload.github.com/frankfarrell/terraform-provider-redshift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238597387,"owners_count":19498396,"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":["aws","redshift","terraform","terraform-provider"],"created_at":"2025-02-13T04:31:49.880Z","updated_at":"2025-10-28T04:33:11.339Z","avatar_url":"https://github.com/frankfarrell.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform Redshift Provider\n\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/076b7e35151040f1802b500f218950d1)](https://www.codacy.com/app/frankfarrell/terraform-provider-redshift?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=frankfarrell/terraform-provider-redshift\u0026amp;utm_campaign=Badge_Grade)\n[![Build Status](https://travis-ci.org/frankfarrell/terraform-provider-redshift.svg?branch=master)](https://travis-ci.org/frankfarrell/terraform-provider-redshift)\n[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/terraform-redshift-provider)\n\nManage Redshift users, groups, privileges, databases and schemas. It runs the SQL queries necessary to manage these (CREATE USER, DELETE DATABASE etc)\nin transactions, and also reads the state from the tables that store this state, eg pg_user_info, pg_group etc. The underlying tables are more or less equivalent to the postgres tables, \nbut some tables are not accessible in Redshift. \n\nCurrently supports users, groups, schemas and databases. You can set privileges for groups on schemas. Per user schema privileges will be added at a later date. \n\nNote that schemas are the lowest level of granularity here, tables should be created by some other tool, for instance flyway. \n\n# Get it:\nDownload for amd64 (for other architectures and OSes you can build from source as descibed below)\n* [Windows](https://github.com/frankfarrell/terraform-provider-redshift/raw/master/dist/windows/amd64/terraform-provider-redshift_v0.0.2_x4.exe)\n* [Linux](https://github.com/frankfarrell/terraform-provider-redshift/raw/master/dist/linux/amd64/terraform-provider-redshift_v0.0.2_x4)\n* [Mac](https://github.com/frankfarrell/terraform-provider-redshift/raw/master/dist/darwin/amd64/terraform-provider-redshift_v0.0.2_x4)\n\nAdd to terraform plugins directory: https://www.terraform.io/docs/configuration/providers.html#third-party-plugins\n\nYou wll need to run `terraform init to download install the plugin from here`\n\n## Examples: \n\nProvider configuration\n```\nprovider redshift {\n  \"url\" = \"localhost\",\n  user = \"testroot\",\n  password = \"Rootpass123\",\n  database = \"dev\"\n}\n```\n\nCreating an admin user who is in a group and who owns a new database, with a password that expires\n```\n# Create a user\nresource \"redshift_user\" \"testuser\"{\n  \"username\" = \"testusernew\" # User name are not immutable. \n  # Terraform can't read passwords, so if the user changes their password it will not be picked up. One caveat is that when the user name is changed, the password is reset to this value\n  \"password\" = \"Testpass123\" # You can pass an md5 encryted password here by prefixing the hash with md5\n  \"valid_until\" = \"2018-10-30\" # See below for an example with 'password_disabled'\n  \"connection_limit\" = \"4\"\n  \"createdb\" = true\n  \"syslog_access\" = \"UNRESTRICTED\"\n  \"superuser\" = true\n}\n\n# Add the user to a new group\nresource \"redshift_group\" \"testgroup\" {\n  \"group_name\" = \"testgroup\" # Group names are not immutable\n  \"users\" = [\"${redshift_user.testuser.id}\"] # A list of user ids as output by terraform (from the pg_user_info table), not a list of usernames (they are not immnutable)\n}\n\n# Create a schema\nresource \"redshift_schema\" \"testschema\" {\n  \"schema_name\" = \"testschema\", # Schema names are not immutable\n  \"owner\" =\"${redshift_user.testuser.id}\", # This defaults to the current user (eg as specified in the provider config) if empty\n  \"cascade_on_delete\" = true\n}\n\n# Give that group select, insert and references privileges on that schema\nresource \"redshift_group_schema_privilege\" \"testgroup_testchema_privileges\" {\n  \"schema_id\" = \"${redshift_schema.testschema.id}\" # Id rather than group name\n  \"group_id\" = \"${redshift_group.testgroup.id}\" # Id rather than group name\n  \"select\" = true\n  \"insert\" = true\n  \"update\" = false\n  \"references\" = true\n  \"delete\" = false # False values are optional\n}\n```\n\nYou can only create resources in the db configured in the provider block. Since you cannot configure providers with \nthe output of resources, if you want to create a db and configure resources you will need to configure it through a `terraform_remote_state` data provider. \nEven if you specifiy the name directly rather than as a variable, since providers are configured before resources you will need to have them in separate projects. \n\n```\n# First file:\n\nresource \"redshift_database\" \"testdb\" {\n  \"database_name\" = \"testdb\", # This isn't immutable\n  \"owner\" =\"${redshift_user.testuser.id}\",\n  \"connection_limit\" = \"4\"\n}\n\noutput \"testdb_name\" {\n  value = \"${redshift_database.testdb.database_name}\"\n}\n\n# Second file: \n\ndata \"terraform_remote_state\" \"redshift\" {\n  backend = \"s3\"\n  config {\n    bucket = \"somebucket\"\n    key = \"somekey\"\n    region = \"us-east-1\"\n  }\n}\n\nprovider redshift {\n  \"url\" = \"localhost\",\n  user = \"testroot\",\n  password = \"Rootpass123\",\n  database = \"${data.terraform_remote_state.redshift.testdb_name}\"\n}\n\n```\n\nCreating a user who can only connect using IAM Credentials as described [here](https://docs.aws.amazon.com/redshift/latest/mgmt/generating-user-credentials.html)\n\n```\nresource \"redshift_user\" \"testuser\"{\n  \"username\" = \"testusernew\",\n  \"password_disabled\" = true # No need to specify a pasword is this is true\n  \"connection_limit\" = \"1\"\n}\n```\n\n## Things to note\n### Limitations\nFor authoritative limitations, please see the Redshift documentations. \n1) You cannot delete the database you are currently connected to. \n2) You cannot set table specific privileges since this provider is table agnostic (for now, if you think it would be feasible to manage tables let me know)\n3) On importing a user, it is impossible to read the password (or even the md hash of the password, since Redshift restricts access to pg_shadow)\n\n### I usually connect through an ssh tunnel, what do I do?\nThe easiest thing is probably to update your hosts file so that the url resolves to localhost\n\n## Contributing: \n\n### Prequisites to development\n1. Go installed\n2. Terraform installed locally\n\n### Building: \n1. Run `go build -o terraform-provider-redshift_v0.0.1_x4.exe`. You will need to tweak this with GOOS and GOARCH if you are planning to build it for different OSes and architectures\n2. Add to terraform plugins directory: https://www.terraform.io/docs/configuration/providers.html#third-party-plugins\n\nYou can debug crudely by setting the TF_LOG env variable to DEBUG. Eg \n```\n$ TF_LOG=DEBUG terraform apply\n```\n\n## TODO \n1. Database property for Schema\n2. Schema privileges on a per user basis\n3. Add privileges for languages and functions\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrankfarrell%2Fterraform-provider-redshift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrankfarrell%2Fterraform-provider-redshift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrankfarrell%2Fterraform-provider-redshift/lists"}