Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

f/resource_aws_glue_crawler:remove-table_prefix #15268

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions aws/resource_aws_glue_crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,8 @@ func updateCrawlerInput(crawlerName string, d *schema.ResourceData) (*glue.Updat

crawlerInput.SchemaChangePolicy = expandGlueSchemaChangePolicy(d.Get("schema_change_policy").([]interface{}))

if tablePrefix, ok := d.GetOk("table_prefix"); ok {
crawlerInput.TablePrefix = aws.String(tablePrefix.(string))
}
crawlerInput.TablePrefix = aws.String(d.Get("table_prefix").(string))

if configuration, ok := d.GetOk("configuration"); ok {
crawlerInput.Configuration = aws.String(configuration.(string))
}
Expand Down
33 changes: 33 additions & 0 deletions aws/resource_aws_glue_crawler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,39 @@ func TestAccAWSGlueCrawler_TablePrefix(t *testing.T) {
})
}

func TestAccAWSGlueCrawler_RemoveTablePrefix(t *testing.T) {
var crawler glue.Crawler
rName := acctest.RandomWithPrefix("tf-acc-test")
resourceName := "aws_glue_crawler.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSGlueCrawlerDestroy,
Steps: []resource.TestStep{
{
Config: testAccGlueCrawlerConfig_TablePrefix(rName, "prefix"),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSGlueCrawlerExists(resourceName, &crawler),
resource.TestCheckResourceAttr(resourceName, "table_prefix", "prefix"),
),
},
{
Config: testAccGlueCrawlerConfig_TablePrefix(rName, ""),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSGlueCrawlerExists(resourceName, &crawler),
resource.TestCheckResourceAttr(resourceName, "table_prefix", ""),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAWSGlueCrawler_Tags(t *testing.T) {
var crawler1, crawler2, crawler3 glue.Crawler
rName := acctest.RandomWithPrefix("tf-acc-test")
Expand Down