Creates an AWS AppFlow connector profile for Redshift, including necessary IAM roles and policies, an S3 bucket, and a Redshift cluster.

Terraform Template

data "aws_iam_policy" "example" {
  name = "AmazonRedshiftAllCommandsFullAccess"
}

resource "aws_appflow_connector_profile" "example" {
  connection_mode = "Public"

  connector_profile_config {

    connector_profile_credentials {

      redshift {
        password = aws_redshift_cluster.example.master_password
        username = aws_redshift_cluster.example.master_username
      }
    }
  }
  connector_type = "Redshift"
  name = "example_profile"
}

resource "aws_iam_role" "example" {
  assume_role_policy = jsonencode({
 Version = "2012-10-17"
 Statement = [
 {
 Action = "sts:AssumeRole"
 Effect = "Allow"
 Sid = ""
 Principal = {
 Service = "ec2.amazonaws.com"
 }
 },
 ]
 })
  managed_policy_arns = [data.aws_iam_policy.test.arn]
  name = "example_role"
}

resource "aws_redshift_cluster" "example" {
  cluster_identifier = "example_cluster"
  cluster_type = "single-node"
  database_name = "example_db"
  master_password = "examplePassword123!"
  master_username = "exampleuser"
  node_type = "dc1.large"
}

resource "aws_s3_bucket" "example" {
  bucket = "example_bucket"
}