@TaskAction public void createHostedZone() { // to enable conventionMappings feature String hostedZoneId = getHostedZoneId(); AmazonRoute53PluginExtension ext = getProject().getExtensions().getByType(AmazonRoute53PluginExtension.class); AmazonRoute53 route53 = ext.getClient(); route53.deleteHostedZone(new DeleteHostedZoneRequest(hostedZoneId)); getLogger().info("HostedZone {} is deleted successfully.", hostedZoneId); } }