Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR extends the
redshift_schema
resource and data source to support all of the available flavours of external schema documented at https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_SCHEMA.html. There is a new nested configuration block in theredshift_schema
resource, namedexternal_schema
.Supported external schema sources are:
data_catalog_source
for AWS Glue Data Cataloghive_metastore_source
for a Hive metastore (I think really it only supports EMR but I haven't tested it as I don't have a Hadoop environment to test against, EMR or otherwise)rds_postgres_source
for federated query against RDS/Aurora PostgreSQLrds_mysql_source
for federated query against RDS/Aurora MySQL (note that this is currently a Preview feature and thus subject to change. Your Redshift cluster must be on the Preview maintenance track to use this)redshift_source
for querying a datashare from another redshift cluster (both clusters must use an instance family which supports data sharing... currently only the new RA3 instance types support data sharing)Destroy/recreate is forced when updating a terraform-managed schema, if:
external_schema
to an existing redshift schema resource (switch the schema from internal to external), orexternal_schema
from an existing redshift schema resource (switch the schema from external to internal), orexternal_schema
blockThis is required because
ALTER SCHEMA
does not support external schemas (except for changing the owner)I have included acceptance tests for all data sources, however they are conditionally enabled on specific environment variables being set. I have successfully run the ones for
data_catalog_source
,rds_postgres_source
, andredshift_source
.