func validateModuleOutputs(t *testing.T, terraformOptions *terraform.Options, awsRegion string, expectedPort int64, expectedUser string, expectedDBName string) {

	oRDS := terraform.OutputMap(t, terraformOptions, "rds")

	oRDSInstanceID := oRDS["rds_postgres_id"]
	oRDSSGIDs := oRDS["rds_security_group_ids"]
	oRDShostname := oRDS["rds_hostname"]
	oRDSport, _ := strconv.ParseInt(oRDS["rds_db_port"], 10, 64)
	oRDSuser := oRDS["rds_username"]
	oDBName := oRDS["rds_dbname"]

	// Fails test if Instance ID is nil
	require.NotNil(t, oRDSInstanceID)

	// Information in RDS API can take more than 20 mins to be available. We retry for 40mins before failing
	rdsObj := retry.DoWithRetryInterface(t, "Waiting RDS API to be available", 20, 2*time.Minute, func() (interface{}, error) {
		return aws.GetRdsInstanceDetailsE(t, oRDSInstanceID, awsRegion)
	}).(*rds.DBInstance)

	t.Run("validate_address", func(t *testing.T) {
		// Verify that the address is not null and equal to output
		address := aws.GetAddressOfRdsInstance(t, oRDSInstanceID, awsRegion)
		require.NotNil(t, address)
		assert.Equal(t, oRDShostname, address)
		assert.Equal(t, oRDShostname, *rdsObj.Endpoint.Address)
	})

	t.Run("validate_port", func(t *testing.T) {
		// Verify that the DB instance is listening on the expected port and equal to output
		port := aws.GetPortOfRdsInstance(t, oRDSInstanceID, awsRegion)
		assert.Equal(t, expectedPort, port)
		assert.Equal(t, int64(oRDSport), port)
	})

	t.Run("validate_SG", func(t *testing.T) {
		// Verify Sec Group IDs output is not nil
		assert.NotNil(t, oRDSSGIDs)
	})

	t.Run("validate_user", func(t *testing.T) {
		// Verify that user is the same as expected and equal to output
		assert.Equal(t, expectedUser, *rdsObj.MasterUsername)
		assert.NotNil(t, oRDSuser)
	})

	t.Run("validate_dbname", func(t *testing.T) {
		// Verify that dbName is the same as expected and equal to output
		assert.Equal(t, expectedDBName, *rdsObj.DBName)
		assert.Equal(t, oDBName, *rdsObj.DBName)
	})

}
// validateModuleOutputs validates the values of outputs with expected values
validateModuleOutputs validates the values of outputs with expected values
// validateModuleOutputs validates the values of outputs with expected values
func validateModuleOutputs(t *testing.T, terraformOptions *terraform.Options, awsRegion string, expectedPort int64, expectedUser string, expectedDBName string) {
	oRDS := terraform.OutputMap(t, terraformOptions, "rds")
	oRDSInstanceID := oRDS["rds_postgres_id"]
	oRDSSGIDs := oRDS["rds_security_group_ids"]
	oRDShostname := oRDS["rds_hostname"]
	oRDSport, _ := strconv.ParseInt(oRDS["rds_db_port"], 10, 64)
	oRDSuser := oRDS["rds_username"]
	oDBName := oRDS["rds_dbname"]
	require.NotNil(t, oRDSInstanceID)
	rdsObj := retry.DoWithRetryInterface(t, "Waiting RDS API to be available", 20, 2*time.Minute, func() (interface{}, error) {
		return aws.GetRdsInstanceDetailsE(t, oRDSInstanceID, awsRegion)
	}).(*rds.DBInstance)
	t.Run("validate_address", func(t *testing.T) {
		address := aws.GetAddressOfRdsInstance(t, oRDSInstanceID, awsRegion)
		require.NotNil(t, address)
		assert.Equal(t, oRDShostname, address)
		assert.Equal(t, oRDShostname, *rdsObj.Endpoint.Address)
	})
	t.Run("validate_port", func(t *testing.T) {
		port := aws.GetPortOfRdsInstance(t, oRDSInstanceID, awsRegion)
		assert.Equal(t, expectedPort, port)
		assert.Equal(t, int64(oRDSport), port)
	})
	t.Run("validate_SG", func(t *testing.T) {
		assert.NotNil(t, oRDSSGIDs)
	})
	t.Run("validate_user", func(t *testing.T) {
		assert.Equal(t, expectedUser, *rdsObj.MasterUsername)
		assert.NotNil(t, oRDSuser)
	})
	t.Run("validate_dbname", func(t *testing.T) {
		assert.Equal(t, expectedDBName, *rdsObj.DBName)
		assert.Equal(t, oDBName, *rdsObj.DBName)
	})
}
func validateModuleOutputs ( t * testing . T , terraformOptions * terraform . Options , awsRegion string , expectedPort int64 , expectedUser string , expectedDBName string ) { oRDS := terraform . OutputMap ( t , terraformOptions , " " ) oRDSInstanceID := oRDS [ " " ] oRDSSGIDs := oRDS [ " " ] oRDShostname := oRDS [ " " ] oRDSport , _ := strconv . ParseInt ( oRDS [ " " ] , 10 , 64 ) oRDSuser := oRDS [ " " ] oDBName := oRDS [ " " ] require . NotNil ( t , oRDSInstanceID ) rdsObj := retry . DoWithRetryInterface ( t , " " , 20 , 2 * time . Minute , func ( ) ( interface { } , error ) { return aws . GetRdsInstanceDetailsE ( t , oRDSInstanceID , awsRegion ) } ) . ( * rds . DBInstance ) t . Run ( " " , func ( t * testing . T ) { address := aws . GetAddressOfRdsInstance ( t , oRDSInstanceID , awsRegion ) require . NotNil ( t , address ) assert . Equal ( t , oRDShostname , address ) assert . Equal ( t , oRDShostname , * rdsObj . Endpoint . Address ) } ) t . Run ( " " , func ( t * testing . T ) { port := aws . GetPortOfRdsInstance ( t , oRDSInstanceID , awsRegion ) assert . Equal ( t , expectedPort , port ) assert . Equal ( t , int64 ( oRDSport ) , port ) } ) t . Run ( " " , func ( t * testing . T ) { assert . NotNil ( t , oRDSSGIDs ) } ) t . Run ( " " , func ( t * testing . T ) { assert . Equal ( t , expectedUser , * rdsObj . MasterUsername ) assert . NotNil ( t , oRDSuser ) } ) t . Run ( " " , func ( t * testing . T ) { assert . Equal ( t , expectedDBName , * rdsObj . DBName ) assert . Equal ( t , oDBName , * rdsObj . DBName ) } ) }
validateModuleOutputs validates the values of outputs with expected values
validateModuleOutputs validates the values of outputs with expected values
// Fails test if Instance ID is nil // Information in RDS API can take more than 20 mins to be available. We retry for 40mins before failing // Verify that the address is not null and equal to output // Verify that the DB instance is listening on the expected port and equal to output // Verify Sec Group IDs output is not nil // Verify that user is the same as expected and equal to output // Verify that dbName is the same as expected and equal to output