Reputation: 61
I have deployed Azure PostgresSQL Flexible server as a PAAS using terraform which is working fine . Now I want to create different Roles and assign different privilege's for the database using terraform. But it is raising the error which is mentioned bellow. Please have a look and suggests me the proper terraform configuration and required providers for the solution .
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider hashicorp/postgresql: provider registry registry.terraform.io does not have a provider named registry.terraform.io/hashicorp/postgresql
Did you intend to use cyrilgdn/postgresql? If so, you must specify that source address in each module which requires that provider. To see which modules are currently depending on hashicorp/postgresql, run the following command:
terraform provider
terraform {
required_version = ">= 1.1.6"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.20.0"
}
postgresql = {
source = "cyrilgdn/postgresql"
version = "1.15.0"
}
}
}
provider "postgresql" {
host = module.az_pssql_flex.azurerm_postgresql_flexible_server
port = 5432
database = var.databases_names
username = ""
password = ""
sslmode = "require"
connect_timeout = 120
superuser = false
}
Upvotes: 0
Views: 1900
Reputation: 954
Solution to create different Roles and assign different privileges for the database using terraform.
created an "provider.tf" file in the child module and define pssql module
Define the postgresql provider block beside the root module porvider.tf file.
run terraform plan
run terraform apply.
Upvotes: 0