Skip to content

Commit

Permalink
more glue
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesWoolfenden committed Aug 18, 2022
1 parent e5879dc commit 0520f90
Show file tree
Hide file tree
Showing 12 changed files with 155 additions and 15 deletions.
4 changes: 4 additions & 0 deletions src/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ func GetAWSResourcePermissions(result ResourceV2) []string {
"aws_glue_catalog_table": awsGlueCatalogTable,
"aws_glue_classifier": awsGlueClassifier,
"aws_glue_crawler": awsGlueCrawler,
"aws_glue_connection": awsGlueConnection,
"aws_glue_data_catalog_encryption_settings": awsGlueDataCatalogEncryptionSettings,
"aws_glue_ml_transform": awsGlueMlTransform,
"aws_glue_trigger": awsGlueTrigger,
}

var Permissions []string
Expand Down
12 changes: 12 additions & 0 deletions src/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,5 +313,17 @@ var awsGlueCatalogDatabase []byte
//go:embed mapping/aws/resource/aws_glue_catalog_table.json
var awsGlueCatalogTable []byte

//go:embed mapping/aws/resource/aws_glue_connection.json
var awsGlueConnection []byte

//go:embed mapping/aws/resource/aws_glue_data_catalog_encryption_settings.json
var awsGlueDataCatalogEncryptionSettings []byte

//go:embed mapping/aws/resource/aws_glue_ml_transform.json
var awsGlueMlTransform []byte

//go:embed mapping/aws/resource/aws_glue_trigger.json
var awsGlueTrigger []byte

//go:embed mapping/gcp/google_compute_instance.json
var googleComputeInstance []byte
23 changes: 23 additions & 0 deletions src/mapping/aws/resource/aws_glue_connection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[
{
"apply": [
"glue:DeleteConnection",
"glue:GetConnection",
"glue:CreateConnection",
"glue:GetTags"
],
"attributes": {
"tags": [
"glue:TagResource",
"glue:UntagResource"
]
},
"destroy": [
"glue:DeleteConnection"
],
"modify": [
"glue:UpdateConnection"
],
"plan": []
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"apply": [
"glue:PutDataCatalogEncryptionSettings",
"glue:GetDataCatalogEncryptionSettings"
],
"attributes": {
"tags": []
},
"destroy": [],
"modify": [],
"plan": []
}
]
19 changes: 19 additions & 0 deletions src/mapping/aws/resource/aws_glue_ml_transform.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"apply": [
"glue:DeleteMLTransform",
"glue:GetMLTransform",
"glue:CreateMLTransform"
],
"attributes": {
"tags": []
},
"destroy": [
"glue:DeleteMLTransform"
],
"modify": [
"glue:UpdateMLTransform"
],
"plan": []
}
]
22 changes: 22 additions & 0 deletions src/mapping/aws/resource/aws_glue_trigger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"apply": [
"glue:GetTrigger",
"glue:CreateTrigger",
"glue:DeleteTrigger"
],
"attributes": {
"tags": [
"TagResource",
"UntagResource"
]
},
"destroy": [
"glue:DeleteTrigger"
],
"modify": [
"glue:UpdateTrigger"
],
"plan": []
}
]
12 changes: 12 additions & 0 deletions terraform/backup/aws_glue_connection.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resource "aws_glue_connection" "example" {
connection_properties = {
JDBC_CONNECTION_URL = "jdbc:mysql://example.com/exampledatabase"
PASSWORD = "examplepassword"
USERNAME = "exampleusername"
}

name = "example"
tags = {
pike = "permissions"
}
}
13 changes: 13 additions & 0 deletions terraform/backup/aws_glue_data_catalog_encryption_settings.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resource "aws_glue_data_catalog_encryption_settings" "example" {
data_catalog_encryption_settings {
connection_password_encryption {
aws_kms_key_id = "arn:aws:kms:eu-west-2:680235478471:key/34cdce9a-2322-427c-91bb-b572f435c032"
return_connection_password_encrypted = true
}

encryption_at_rest {
catalog_encryption_mode = "SSE-KMS"
sse_aws_kms_key_id = "arn:aws:kms:eu-west-2:680235478471:key/34cdce9a-2322-427c-91bb-b572f435c032"
}
}
}
19 changes: 19 additions & 0 deletions terraform/backup/aws_glue_ml_transform.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "aws_glue_ml_transform" "test" {
name = "example"
role_arn = aws_iam_role.test.arn

input_record_tables {
database_name = aws_glue_catalog_table.test.database_name
table_name = aws_glue_catalog_table.test.name
}

parameters {
transform_type = "FIND_MATCHES"

find_matches_parameters {
primary_key_column_name = "my_column_1"
}
}

depends_on = [aws_iam_role_policy_attachment.test]
}
15 changes: 15 additions & 0 deletions terraform/backup/aws_glue_trigger.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
resource "aws_glue_trigger" "example" {
name = "example"
type = "CONDITIONAL"

actions {
job_name = aws_glue_job.example1.name
}

predicate {
conditions {
job_name = aws_glue_job.example2.name
state = "SUCCEEDED"
}
}
}
6 changes: 2 additions & 4 deletions terraform/role/aws_iam_policy.basic.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ resource "aws_iam_policy" "basic" {
"Sid" : "0",
"Effect" : "Allow",
"Action" : [
"glue:DeleteClassifier",
"glue:CreateClassifier",
"glue:UpdateClassifier",
"glue:GetClassifier"
"glue:PutDataCatalogEncryptionSettings",
"glue:GetDataCatalogEncryptionSettings"
],
"Resource" : "*"
}
Expand Down
11 changes: 0 additions & 11 deletions todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,14 @@
aws_fsx_openzfs_file_system not implemented
aws_fsx_openzfs_snapshot not implemented
aws_fsx_openzfs_volume not implemented
aws_glue_connection not implemented
aws_glue_connection not implemented
aws_glue_data_catalog_encryption_settings not implemented
aws_glue_job not implemented
aws_glue_ml_transform not implemented
aws_glue_partition not implemented
aws_glue_partition_index not implemented
aws_glue_registry not implemented
aws_glue_resource_policy not implemented
aws_glue_schema not implemented
aws_glue_security_configuration not implemented
aws_glue_security_configuration not implemented
aws_glue_trigger not implemented
aws_glue_trigger not implemented
aws_glue_trigger not implemented
aws_glue_trigger not implemented
aws_glue_trigger not implemented
aws_glue_trigger not implemented
aws_glue_trigger not implemented
aws_glue_user_defined_function not implemented
aws_glue_workflow not implemented
aws_guardduty_detector not implemented
Expand Down

0 comments on commit 0520f90

Please sign in to comment.