Data Source: awsGlueScript
Use this data source to generate a Glue script from a Directed Acyclic Graph (DAG).
Example Usage
Generate Python Script
import * as cdktf from "cdktf";
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsGlueScriptExample = new aws.dataAwsGlueScript.DataAwsGlueScript(
this,
"example",
{
dagEdge: [
{
source: "datasource0",
target: "applymapping1",
},
{
source: "applymapping1",
target: "selectfields2",
},
{
source: "selectfields2",
target: "resolvechoice3",
},
{
source: "resolvechoice3",
target: "datasink4",
},
],
dagNode: [
{
args: [
{
name: "database",
value: '"${aws_glue_catalog_database.source.name}"',
},
{
name: "table_name",
value: '"${aws_glue_catalog_table.source.name}"',
},
],
id: "datasource0",
nodeType: "DataSource",
},
{
args: [
{
name: "mapping",
value: '[("column1", "string", "column1", "string")]',
},
],
id: "applymapping1",
nodeType: "ApplyMapping",
},
{
args: [
{
name: "paths",
value: '["column1"]',
},
],
id: "selectfields2",
nodeType: "SelectFields",
},
{
args: [
{
name: "choice",
value: '"MATCH_CATALOG"',
},
{
name: "database",
value: '"${aws_glue_catalog_database.destination.name}"',
},
{
name: "table_name",
value: '"${aws_glue_catalog_table.destination.name}"',
},
],
id: "resolvechoice3",
nodeType: "ResolveChoice",
},
{
args: [
{
name: "database",
value: '"${aws_glue_catalog_database.destination.name}"',
},
{
name: "table_name",
value: '"${aws_glue_catalog_table.destination.name}"',
},
],
id: "datasink4",
nodeType: "DataSink",
},
],
language: "PYTHON",
}
);
new cdktf.TerraformOutput(this, "python_script", {
value: dataAwsGlueScriptExample.pythonScript,
});
Generate Scala Code
import * as cdktf from "cdktf";
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsGlueScriptExample = new aws.dataAwsGlueScript.DataAwsGlueScript(
this,
"example",
{
dagEdge: [
{
source: "datasource0",
target: "applymapping1",
},
{
source: "applymapping1",
target: "selectfields2",
},
{
source: "selectfields2",
target: "resolvechoice3",
},
{
source: "resolvechoice3",
target: "datasink4",
},
],
dagNode: [
{
args: [
{
name: "database",
value: '"${aws_glue_catalog_database.source.name}"',
},
{
name: "table_name",
value: '"${aws_glue_catalog_table.source.name}"',
},
],
id: "datasource0",
nodeType: "DataSource",
},
{
args: [
{
name: "mappings",
value: '[("column1", "string", "column1", "string")]',
},
],
id: "applymapping1",
nodeType: "ApplyMapping",
},
{
args: [
{
name: "paths",
value: '["column1"]',
},
],
id: "selectfields2",
nodeType: "SelectFields",
},
{
args: [
{
name: "choice",
value: '"MATCH_CATALOG"',
},
{
name: "database",
value: '"${aws_glue_catalog_database.destination.name}"',
},
{
name: "table_name",
value: '"${aws_glue_catalog_table.destination.name}"',
},
],
id: "resolvechoice3",
nodeType: "ResolveChoice",
},
{
args: [
{
name: "database",
value: '"${aws_glue_catalog_database.destination.name}"',
},
{
name: "table_name",
value: '"${aws_glue_catalog_table.destination.name}"',
},
],
id: "datasink4",
nodeType: "DataSink",
},
],
language: "SCALA",
}
);
new cdktf.TerraformOutput(this, "scala_code", {
value: dataAwsGlueScriptExample.scalaCode,
});
Argument Reference
dagEdge
- (Required) List of the edges in the DAG. Defined below.dagNode
- (Required) List of the nodes in the DAG. Defined below.language
- (Optional) Programming language of the resulting code from the DAG. Defaults topython
. Valid values arepython
andscala
.
dag_edge Argument Reference
source
- (Required) ID of the node at which the edge starts.target
- (Required) ID of the node at which the edge ends.targetParameter
- (Optional) Target of the edge.
dag_node Argument Reference
args
- (Required) Nested configuration an argument or property of a node. Defined below.id
- (Required) Node identifier that is unique within the node's graph.nodeType
- (Required) Type of node this is.lineNumber
- (Optional) Line number of the node.
args Argument Reference
name
- (Required) Name of the argument or property.value
- (Required) Value of the argument or property.param
- (Optional) Boolean if the value is used as a parameter. Defaults tofalse
.
Attributes Reference
id
- AWS Region.pythonScript
- Python script generated from the DAG when thelanguage
argument is set topython
.scalaCode
- Scala code generated from the DAG when thelanguage
argument is set toscala
.